Too*_*tje 2 email ruby-on-rails office365
我有Godaddy的Office 365邮件帐户.我正在尝试为我的Rails应用设置SMTP设置:
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "smtp.office365.com",
:port => 587,
:user_name => ENV["OFFICE_USERNAME"],
:password => ENV["OFFICE_PASSWORD"],
:authentication => 'login',
:domain => 'example.com',
:enable_starttls_auto => true }
Run Code Online (Sandbox Code Playgroud)
但是当我通过从我的联系页面提交消息来测试这些设置时,我收到以下错误消息:
550 5.7.1客户端无权作为此发件人发送
如何在Rails应用程序中设置Office 365帐户的SMTP设置?
gku*_*sik 17
我在这里找到了这个问题的答案:http: //www.brownwebdesign.com/blog/connecting-rails-to-microsoft-exchange-smtp-email-server
相关部分:
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => 'smtp.office365.com',
:port => '587',
:authentication => :login,
:user_name => ENV['SMTP_USERNAME'],
:password => ENV['SMTP_PASSWORD'],
:domain => 'congrueit.com',
:enable_starttls_auto => true
}
Run Code Online (Sandbox Code Playgroud)
然后:
确保from:电子邮件地址与域名和用户/通行证匹配.
不是我的工作只是复制和粘贴对我有用的相关信息.