I am trying to send mail from ruby โโto a rails application on heroku via sendgrid. This is a standalone application that tries to send a test email. I do not receive errors, but 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: " abc@yahoo.com "
I tried running the test_notification method from heroku console
>> Notifier.test_notification
(This displays some log information ..)
#<Mail:Message:279922420, Multipart: false, Headers: <from.., To, Subject, etc).
But send_grid does not report any mail sent from my account. Do not receive email.
I also tried sending mail in another way by calling test_notification from / home / index / controller, which will be sent when I visit the applicationโs home page.
=== class HomeController < ApplicationController def index Notifier.test_notification() end end ===
Statistics also do not report sent mail. Any help is appreciated.
Thanks! DS
source share