aboutsummaryrefslogtreecommitdiff
path: root/gem/ex12.lua
diff options
context:
space:
mode:
authorCaleb Maclennan <caleb@alerque.com>2023-11-10 09:12:04 +0300
committerCaleb Maclennan <caleb@alerque.com>2023-11-10 09:12:04 +0300
commit5c4fc93d5f4137bf4c22ddf1a048c907a4a26727 (patch)
treea9a68e1f6a9c3bfe2b64fa1c3a4098865b7d3b5d /gem/ex12.lua
parentccef3bc4e2aa6ee5b997a80aabb58f4ff0b0e98f (diff)
parent43a97b7f0053313b43906371dbdc226271e6c8ab (diff)
downloadluasocket-hjelmeland-patch-1.tar.gz
luasocket-hjelmeland-patch-1.tar.bz2
luasocket-hjelmeland-patch-1.zip
Merge branch 'master' into hjelmeland-patch-1hjelmeland-patch-1
Diffstat (limited to '')
-rw-r--r--gem/ex12.lua34
1 files changed, 0 insertions, 34 deletions
diff --git a/gem/ex12.lua b/gem/ex12.lua
deleted file mode 100644
index de17d76..0000000
--- a/gem/ex12.lua
+++ /dev/null
@@ -1,34 +0,0 @@
1local smtp = require"socket.smtp"
2local mime = require"mime"
3local ltn12 = require"ltn12"
4
5CRLF = "\013\010"
6
7local message = smtp.message{
8 headers = {
9 from = "Sicrano <sicrano@example.com>",
10 to = "Fulano <fulano@example.com>",
11 subject = "A message with an attachment"},
12 body = {
13 preamble = "Hope you can see the attachment" .. CRLF,
14 [1] = {
15 body = "Here is our logo" .. CRLF},
16 [2] = {
17 headers = {
18 ["content-type"] = 'image/png; name="luasocket.png"',
19 ["content-disposition"] =
20 'attachment; filename="luasocket.png"',
21 ["content-description"] = 'LuaSocket logo',
22 ["content-transfer-encoding"] = "BASE64"},
23 body = ltn12.source.chain(
24 ltn12.source.file(io.open("luasocket.png", "rb")),
25 ltn12.filter.chain(
26 mime.encode("base64"),
27 mime.wrap()))}}}
28
29assert(smtp.send{
30 rcpt = "<diego@cs.princeton.edu>",
31 from = "<diego@cs.princeton.edu>",
32 server = "localhost",
33 port = 2525,
34 source = message})