【发布时间】:2014-05-20 10:41:34
【问题描述】:
我有一个 Rails 应用程序,我在其中构建了一个联系表单。 它使用此配置在本地工作:
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: 587,
domain: ENV["GMAIL_DOMAIN"],
authentication: "plain",
enable_starttls_auto: true,
user_name: ENV["GMAIL_USERNAME"],
password: ENV["GMAIL_PASSWORD"]
}
end
现在我想用 Mandrill 让它在 Heroku 上运行,所以这是我的 production.rb
config.action_mailer.smtp_settings = {
:address => "smtp.mandrillapp.com",
:port => 587,
:user_name => ENV["MANDRILL_USERNAME"],
:password => ENV["MANDRILL_APIKEY"]
}
# ActionMailer Config
config.action_mailer.default_url_options = { :host => 'myDomain.com' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = false
当我访问网站时,填写表格并点击“发送”,这是日志:
2014-04-07T23:35:56.661073+00:00 app[web.1]:处理者 ContatoController#create as HTML 2014-04-07T23:35:56.661073+00:00 app[web.1]:参数:{"utf8"=>"???", "auth enticity_token"=>"", "contato"=>{"name"=>"test1", "email"=>"myEmail@email.com", "消息"=>"sdfsdffsd", "昵称"=>""}, "提交"=>"发送"} 2014-04-07T23:35:56.661073+00:00 app[web.1]:参数: {"utf8"=>"???", "auth entity_token"=>"5769b554vJsVK3KldK/EmSaN8yUF/z4S7LZdzSlZ6XE=", "contato"=>{"name"=>"test1", "email"=>"myEmail@email.com", "消息"=>"sdfsdffsd", "昵称"=>""}, "提交"=>"发送"} 2014-04-07T23:35:56.668905+00:00 应用 [web.1]:渲染 供应商/捆绑/红宝石/1.9.1 /gems/mail_form-1.5.0/lib/mail_form/views/mail_form/contact.erb (1.1ms) 2014-04-07T23:35:56.668905+00:00 app[web.1]: 渲染 供应商/捆绑/红宝石/1.9.1 /gems/mail_form-1.5.0/lib/mail_form/views/mail_form/contact.erb (1.1 毫秒)2014-04-07T23:35:58.200457+00:00 应用 [web.1]: 2014-04-07T23:35:58.200457+00:00 app[web.1]:发送邮件到 我的电子邮件@gmail.com(153 0.1ms) 2014-04-07T23:35:58.200457+00:00 app[web.1]: 2014-04-07T23:35:58.200457+00:00 app[web.1]: 发送邮件到 我的电子邮件@gmail.com (153 0.1ms) 2014-04-07T23:35:58.209656+00:00 heroku[router]: at=info method=POST path=/conta to host=myDomain.com request_id=b3b2f599-a685-4968-97a1-9dd7a3508083 fwd="20 1.37.139.250" dyno=web.1 connect=2ms service=1558ms status=200 bytes=6107
但是电子邮件永远不会来。 Mandril 也不算发送的电子邮件。
因为我使用通知电子邮件作为“发件人地址”,所以我将其更改为 no-reply@myDomain.com 并将其添加到 mandrill 的发送域列表中。但仍然没有任何反应。
什么可能导致这个错误?
【问题讨论】: