LuaSocket smtp连接被拒绝了

时间:2013-06-06 20:03:09

标签: lua smtp luasocket

我想使用套接字库从lua向gmail帐户发送电子邮件。

smtp = require("socket.smtp")

address = { "<someone@gmail.com>" }
from    = { "<someone@gmail.com>" }
theMessage = {
 headers = {
   to = "YOU",
   cc = '"him" ',
   subject = "I got something to tell you..."
 },
 body = "You're the best."
}
r, e = smtp.send{ from = from, rcpt = address, source = smtp.message(theMessage)}

当我这样做的时候      打印(e)中

“拒绝连接”。

 print(r)

零 有什么想法吗?

我只是按照网站上的说明操作:      http://w3.impa.br/~diego/software/luasocket/smtp.html

1 个答案:

答案 0 :(得分:1)

您可能需要在smtp.send函数

中指定ip / port
smtp.send{ 
    from = from, 
    rcpt = address, 
    source = smtp.message(theMessage),
    server = 127.0.0.1,
    port   = 25
}