Open sparvu opened 5 years ago
@sparvu: I believe this is because Yahoo disables standard SMTP PLAIN
and LOGIN
authentication mechanisms by default (similar to Gmail). Instead, it prefers the XOAUTH2
authentication mechanism, which is not something lua-resty-mail currently supports. If you'd like to use lua-resty-mail with Yahoo Mail, it should be possible as long as you enable the option to "Allow apps that use less secure sign in" (a similar requirements is necessary if trying to send standard SMTP mail with Gmail). Here's an article that explains this fairly well (including whether or not you should be concerned about this "less secure" option): https://foundry376.zendesk.com/hc/en-us/articles/115001882372-Authorizing-Use-with-Yahoo
With that option enabled, I was then able to successfully send mail via Yahoo with this snippet:
local mailer, mailer_err = mail.new({
host = "smtp.mail.yahoo.com",
port = 587,
username = "YOUR_USERNAME@yahoo.com",
password = "YOUR_PASSWORD",
})
local ok, err = mailer:send({
from = "YOUR_USERNAME@yahoo.com",
to = { "test@example.com" },
subject = "Your Subject",
text = "Your Message",
})
Adding support for XOAUTH2
might be the best option for lua-resty-mail, although that's not something I personally need, so pull requests would be welcome. Most language SMTP libraries don't seem to support this authentication mechanism out of the box, since I think it's predominantly used by the likes of Gmail and Yahoo for personal mail services. But here's a few other implementations/notes: https://github.com/nfo/gmail_xoauth https://github.com/andris9/xoauth2 https://github.com/PHPMailer/PHPMailer/wiki/Using-Gmail-with-XOAUTH2
right. thanks for comments. will try the settings for Yahoo. Of course would be sweet to have XOAUTH2 support.
We have switched to use your Lua library for sending emails within OpenResty. It works fine for Google, our own SMTP server 465 and submission 587.
However on Yahoo, we are seeing problems. The errors, received on 465 or 587 are same:
Can you please test your library with Yahoo services ? Thanks.