我試圖通過sendgrid從Heroku上的Rails應用程序上的ruby發送郵件。 這是一個只嘗試發送測試電子郵件的獨立應用程序。我沒有收到任何錯誤,但郵件沒有發送。感謝您的幫助。郵件未發送:使用Ruby on Rails的heroku上的sendgrid
== config/environment.rb ===
ActionMailer::Base.smtp_settings = {
:user_name => ENV['SENDGRID_USERNAME'],
:password => ENV['SENDGRID_PASSWORD'],
:domain => ENV['SENDGRID_DOMAIN'],
:address => "smtp.sendgrid.net",
:port => 587,
:authentication => :plain,
}
===
==== config/environments/production.rb ===
config.action_mailer.delivery_method = :smtp
config.action_mailer.raise_delivery_errors = true
=====
== app/models/notifier.rb ==
class Notifier < ActionMailer::Base
include SendGrid
default from: "[email protected]"
#sendgrid_category :use_subject_lines
#sengrid_enable :ganalytics, :opentrack
def test_notification
mail(:to => "[email protected]", :subject => "mail from heroku")
puts("Sent mail from notifier")
end
end
========
我試圖從Heroku的控制檯
>> Notifier.test_notification
(此打印出一些日誌信息。)
#<Mail:Message:279922420, Multipart: false, Headers: <from.., To, Subject, etc).
運行test_notification方法,但send_grid不報告發出的任何郵件從我的帳戶。我沒有收到電子郵件。
我也嘗試通過調用/ home/index/controller中的test_notification來發送郵件,這將在訪問應用程序的主頁時發送。作爲發送要麼
===
class HomeController < ApplicationController
def index
Notifier.test_notification()
end
end
===
統計不報告的郵件。任何幫助是極大的讚賞。
謝謝! DS
我有同樣的問題。我認爲整合剛剛破裂。我寫了支持。我們會看看那是怎麼回事。 – devinfoley
你們是否能夠弄清楚這一點?我有同樣的問題。 – hajpoj