Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/56.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Rails、Heroku、ActionMailer、Sendgrid:Heroku日志显示已发送电子邮件,但未收到任何电子邮件_Ruby On Rails_Email_Heroku_Actionmailer_Sendgrid - Fatal编程技术网

Ruby on rails Rails、Heroku、ActionMailer、Sendgrid:Heroku日志显示已发送电子邮件,但未收到任何电子邮件

Ruby on rails Rails、Heroku、ActionMailer、Sendgrid:Heroku日志显示已发送电子邮件,但未收到任何电子邮件,ruby-on-rails,email,heroku,actionmailer,sendgrid,Ruby On Rails,Email,Heroku,Actionmailer,Sendgrid,这是我第一次尝试用Heroku发送电子邮件,我真的很难配置所有东西。我已经看了几个小时了,不明白为什么我没有收到电子邮件。我在网上到处搜索,似乎找不到我的配置不起作用的原因 如果有人能帮忙,我将不胜感激 我的product.rb文件: config.action_mailer.default_url_options = { :host => 'acebros.herokuapp.com' } config.action_mailer.perform_deliveries = true c

这是我第一次尝试用Heroku发送电子邮件,我真的很难配置所有东西。我已经看了几个小时了,不明白为什么我没有收到电子邮件。我在网上到处搜索,似乎找不到我的配置不起作用的原因

如果有人能帮忙,我将不胜感激

我的
product.rb
文件:

config.action_mailer.default_url_options = { :host => 'acebros.herokuapp.com' }

config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default :charset => "utf-8"

config.action_mailer.smtp_settings = {
  address: 'smtp.sendgrid.net',
  port: '587',
  authentication: "plain",
  user_name: ENV['SENDGRID_USERNAME'],
  password: ENV['SENDGRID_PASSWORD'],
  :domain         => 'heroku.com',
  :enable_starttls_auto => true
}
config.action_mailer.delivery_method = :smtp
邮件发送者示例:

default from: "acebrosdev@gmail.com"
def quote_email(user, quote)
    @customer = user
    @quote = quote
    @url = 'acebros.herokuapp.com/' + quote_status_path(@quote)
    #attachments['quote.pdf'] = WickedPdf.new.pdf_from_string(
                           #render_to_string(:pdf => 'quote', :template =>
                           #'quotes/quote_attachment.html.erb')
                           #)
    mail(to: @customer.email, subject: "Quote ID: ##{@quote.id}")
end
最后,我的heroku日志:

2014-12-08T17:56:38.121051+00:00 app[web.1]: Started POST "/quotes/5/done" for 129.31.193.143 at      2014-12-08 17:56:38 +0000
2014-12-08T17:56:38.241873+00:00 app[web.1]:   Rendered quote_mailer/quote_email.text.erb (0.4ms)
2014-12-08T17:56:39.684236+00:00 app[web.1]: Redirected to http://acebros.herokuapp.com/quotes/5
2014-12-08T17:56:39.683035+00:00 app[web.1]: Sent mail to annikamonari@gmail.com (1093.2ms)
2014-12-08T17:56:39.683029+00:00 app[web.1]: 
2014-12-08T17:56:39.684436+00:00 app[web.1]: Completed 302 Found in 1560ms (ActiveRecord: 26.9ms)
2014-12-08T17:56:39.692999+00:00 heroku[router]: at=info method=POST path="/quotes/5/done"  host=acebros.herokuapp.com request_id=0c19e839-1d20-43ee-9e27-8ba657eb3637 fwd="129.31.193.143" dyno=web.1 connect=2ms service=1572ms status=302 bytes=1246
2014-12-08T17:56:42.352091+00:00 app[web.1]: Processing by QuotesController#show as HTML

我终于找到了解决办法。他们暂时禁用了我的sendgrid帐户,并且由heroku配置自动生成的电子邮件与我的电子邮件不匹配,因此我没有收到它。必须联系客户支持。无论如何,感谢您的帮助。

在SendGrid仪表板中检查您的SendGrid电子邮件活动,以确保它正在被发送:

是否有可能是异步的(在后台工作中)?我不确定这意味着什么,或者我甚至不知道如何检查它?是哪个控制器发送了电子邮件?你在用Desive吗?是否安装了bg作业gems?(工作延迟、Sidekiq、resque)