From ff0f488c97fe8b554b909a0057cebc4c860eac8f Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 20 Oct 2021 13:40:34 +0800 Subject: +luasocket src --- ThirdParty/luasocket/gem/ex12.lua | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 ThirdParty/luasocket/gem/ex12.lua (limited to 'ThirdParty/luasocket/gem/ex12.lua') diff --git a/ThirdParty/luasocket/gem/ex12.lua b/ThirdParty/luasocket/gem/ex12.lua new file mode 100644 index 0000000..de17d76 --- /dev/null +++ b/ThirdParty/luasocket/gem/ex12.lua @@ -0,0 +1,34 @@ +local smtp = require"socket.smtp" +local mime = require"mime" +local ltn12 = require"ltn12" + +CRLF = "\013\010" + +local message = smtp.message{ + headers = { + from = "Sicrano ", + to = "Fulano ", + subject = "A message with an attachment"}, + body = { + preamble = "Hope you can see the attachment" .. CRLF, + [1] = { + body = "Here is our logo" .. CRLF}, + [2] = { + headers = { + ["content-type"] = 'image/png; name="luasocket.png"', + ["content-disposition"] = + 'attachment; filename="luasocket.png"', + ["content-description"] = 'LuaSocket logo', + ["content-transfer-encoding"] = "BASE64"}, + body = ltn12.source.chain( + ltn12.source.file(io.open("luasocket.png", "rb")), + ltn12.filter.chain( + mime.encode("base64"), + mime.wrap()))}}} + +assert(smtp.send{ + rcpt = "", + from = "", + server = "localhost", + port = 2525, + source = message}) -- cgit v1.1-26-g67d0