我从我的Rails应用程序发送电子邮件。在开发环境下,它可以正常工作,但是在暂存环境下失败了。我收到以下错误:
Net::SMTPAuthenticationError (534-5.7.14 <https://accounts.google.com/ContinueSignIn?plt=AKgnsbtdF0yjrQccTO2D_6)
请注意,我的预备环境没有域名。
这是我的staging.rb设置:
config.action_mailer.delivery_method = :smtp
config.action_mailer.default_url_options = { :host => "my.ip.addr.here:80" }
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => 'my.ip.addr.here:80'
:user_name => "my_email_name@gmail.com",
:password => "my_email_password",
:authentication => 'login'
}
请帮忙。
编辑。
在添加 :tls => true
选项后,我得到了:
OpenSSL::SSL::SSLError (Unrecognized SSL message, plaintext connection?)
然后我将端口更改为 25 ,现在我得到了这个(带有 30 秒的延迟):
Timeout::Error (execution expired)