Send email from my domain using SendGrid on Heroku
-
21-12-2019 - |
Question
I have a Rails 4 app which is being hosted by Heroku on my_domain.com. I'm using free SendGrid to send emails, but no matter what settings I use all the emails are sent from my_app@heroku.com
. How can set the settings so that emails are sent from automated@my_domain.com
?
Thanks.
Solution
Go to app/mailers/your_mailer.rb
and add the following line under class YourMailer < ActionMailer::Base
default from: "automated@my_domain.com"
OTHER TIPS
Try control-shift-F (which will pull up a search for your entire codebase). Search for "my_app@heroku.com" and you may be able to find where this variable is being set. Let me know if this doesn't work and I will try something else.
Set in your production.rb,
config.action_mailer.default_options = {from: 'no-reply@example.com'}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow