user1709076
user1709076

Reputation: 2856

LuaSocket smtp connection refused

I am wanting to send an email to a gmail account from lua using the socket library.

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)}

When I do print(e)

"connection refused".

 print(r)

nil Any ideas?

I'm just following instructions from the site: http://w3.impa.br/~diego/software/luasocket/smtp.html

Upvotes: 1

Views: 900

Answers (1)

Tom Studee
Tom Studee

Reputation: 10452

You may need to specify the ip/port in your smtp.send function

smtp.send{ 
    from = from, 
    rcpt = address, 
    source = smtp.message(theMessage),
    server = 127.0.0.1,
    port   = 25
}

Upvotes: 1

Related Questions