【发布时间】:2015-10-16 23:21:30
【问题描述】:
我正在尝试使用远程 smtp 主机从我的 RoR 应用程序发送电子邮件。 这在生产和开发中都在我的本地服务器上工作。
当我设置时
config.action_mailer.raise_delivery_errors
为真,我在日志中收到此错误
Error during failsafe response: 550-sender IP address xx.xx.xxx.xxx is part of Amazon AWS, and may not use this
/usr/local/lib/ruby/2.2.0/net/smtp.rb:964:in `check_response'
/usr/local/lib/ruby/2.2.0/net/smtp.rb:933:in `getok'
/usr/local/lib/ruby/2.2.0/net/smtp.rb:869:in `rcptto'
/usr/local/lib/ruby/2.2.0/net/smtp.rb:850:in `block in rcptto_list'
/usr/local/lib/ruby/2.2.0/net/smtp.rb:848:in `each'
/usr/local/lib/ruby/2.2.0/net/smtp.rb:848:in `rcptto_list'
这是我的动作邮件设置
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: "smtp.thehostname.com",
port: 587,
domain: 'MyDomain.net',
user_name: 'MyUsername',
password: 'MyPassword',
authentication: 'plain',
enable_starttls_auto: true
}
我已经在我的生产环境中设置了这个设置
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true
config.action_mailer.default_url_options = { :host => "subdomain.mydomain.net" }
有人知道为什么我无法从亚马逊 AWS 发送邮件吗?
【问题讨论】:
-
看起来您的邮件服务器有一个访问列表不接受来自 aws 的任何电子邮件(这是一个非常好的主意,因为 aws 可能是一个巨大的垃圾邮件规范)。但是将其应用于身份验证邮件的事实有点奇怪/烦人。不接受来自 aws 的未经身份验证的邮件是有道理的,但阻止身份验证邮件似乎也很严厉。但是最好的办法是与您的邮件服务器管理员/主机交谈,看看他们要说什么,因为您的邮件服务器会生成 550 错误(或者看起来如此)
标签: ruby-on-rails amazon-web-services amazon-ec2 smtp actionmailer