Ruby on rails Rails 4-yandex邮件未发送
在rails 4.2.4中,我使用了电子邮件功能的Ruby on rails Rails 4-yandex邮件未发送,ruby-on-rails,ruby,email,Ruby On Rails,Ruby,Email,在rails 4.2.4中,我使用了电子邮件功能的gem'rails\u config'。在开发环境中,所有邮件都正确发送,但在测试环境中,它显示了一个错误,如Net::SMTPFatalError(553 5.7.1发件人地址被拒绝:不属于auth用户): 在setup_mail.rb中 ActionMailer::Base.smtp_settings = { :address => "smtp.yandex.ru", :port => 465, :domain =>
gem'rails\u config'
。在开发环境中,所有邮件都正确发送,但在测试环境中,它显示了一个错误,如Net::SMTPFatalError(553 5.7.1发件人地址被拒绝:不属于auth用户):
在setup_mail.rb中
ActionMailer::Base.smtp_settings = {
:address => "smtp.yandex.ru",
:port => 465,
:domain => "yandex.ru",
:authentication => :login,
:user_name => "ssstest@yandex.com",
:password => "pwd567@",
:ssl=> true,
:enable_starttls_auto=> true,
:tls=> true
}
在用户_mailer.rb中
class UserMailer < ActionMailer::Base
default from: "ssstest@yandex.com"
...
end
class UserMailer
服务器日志的输出为
D, [2016-05-06T06:24:25.089270 #23566] DEBUG -- :
Devise::Mailer#confirmation_instructions: processed outbound mail in 954.3ms
I, [2016-05-06T06:24:26.500832 #23566] INFO -- :
Sent mail to sample_demo@yopmail.com (1408.8ms)
D, [2016-05-06T06:24:26.501240 #23566] DEBUG -- : Date: Fri, 06 May 2016 06:24:25 +0000
From: please-change-me-at-config-initializers-devise@example.com
Reply-To: please-change-me-at-config-initializers-devise@example.com
To: sample_demo@yopmail.com
Message-ID: <572c389917f09_5c0e10bb99411990@ip-10-65-178-51.mail>
Subject: Confirmation instructions
Mime-Version: 1.0
Content-Type: text/html;
charset=UTF-8
Content-Transfer-Encoding: 7bit
D[2016-05-06T06:24:25.089270#23566]调试--:
设计::邮递员#确认#说明:954.3毫秒内处理出站邮件
一、 [2016-05-06T06:24:26.500832#23566]信息--:
发送邮件至样本_demo@yopmail.com(1408.8毫秒)
D、 调试日期:2016年5月6日星期五06:24:25+0000
发件人:请在配置初始值设定项处更改我-devise@example.com
回复:请在配置初始值设定项处更改我-devise@example.com
致:样品_demo@yopmail.com
消息ID:
主题:确认说明
Mime版本:1.0
内容类型:text/html;
字符集=UTF-8
内容传输编码:7bit
如何解决此问题?请帮助我如错误日志所示,请更改config/initializers/designe.rb中的发件人电子邮件地址
config.mailer_sender = 'ssstest@yandex.com'
如错误日志所示,请更改config/initializers/designe.rb中的发件人电子邮件地址
config.mailer_sender = 'ssstest@yandex.com'
您是否在
环境/test.rb
中添加了config.action\u mailer.delivery\u method=:smtp
?在电子邮件设置中正确存储用户名和密码不是一个好的做法。将它们存储为环境变量 您是否在环境/test.rb
中添加了config.action\u mailer.delivery\u method=:smtp
?在电子邮件设置中正确存储用户名和密码不是一个好的做法。将它们存储为环境变量
port: 465
authentication: login
smtp_enable_starttls_auto: true
smtp_openssl_verify_mode: true
如前所述
如前所述