
Untitled
By: a guest on
May 12th, 2012 | syntax:
Lua | size: 1.21 KB | hits: 31 | expires: Never
local socket = require("socket")
local smtp = require("socket.smtp")
local mime = require("mime")
local ltn12 = require("ltn12")
source = smtp.message{
headers = {
from = "Nego do sabugo <negopretosafado@meu.pau.com>",
to = "Sapequinha <maiara_07_souza@hotmail.com>",
subject = "abre ou eu te abro!"
},
body = {
preamble = "",
[1] = {
body = mime.eol(0, [[Sapequinha
]])
},
[2] = {
headers = {
["content-type"] = 'image/jpg; name="sexp"',
["content-disposition"] = 'attachment; filename="animal.jpg"',
["content-description"] = 'a beautiful image',
["content-transfer-encoding"] = "BASE64"
},
body = ltn12.source.chain (
ltn12.source.file (io.open ("animal.jpg", "rb")),
ltn12.filter.chain (
mime.encode ("base64"),
mime.wrap ()
)
)
}
}
}
r, e = smtp.send{
from = "<dalvo_rsn@yahoo.com.br>",
rcpt = {"<dalvo_rsn@hotmail.com>", "<maiara_07_souza@hotmail.com>"},
source = source,
user = "dalvo_rsn",
password = "759593",
server = "smtp.mail.yahoo.com.br",
port = 25,
domain = "yahoo.com.br",
}
if not r then
print(e)
else
print "foi"
end