I'm attempting to send mail from ruby on rails app on heroku via sendgrid. This is a standalone app only trying to send an test e-mail. I get no errors but the mail is not sent. Your help is appreciated.
== 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
========
I tried running the test_notification method from heroku console
>> Notifier.test_notification
(This prints out some log info..)
#<Mail:Message:279922420, Multipart: false, Headers: <from.., To, Subject, etc).
But send_grid doesn't report any mail sent out from my account. Not do I receive the e-mail.
I have also tried to send mail by an other means by calling test_notification from /home/index/controller which will be sent when visiting the home page of the app.
===
class HomeController < ApplicationController
def index
Notifier.test_notification()
end
end
===
Stats don't report the mail as sent either. Any help is greatly appreciated.
Thanks! DS