Romanch Sharma
Romanch Sharma

Reputation: 132

On Heroku when sending mail through action mailer gives error

I created rails g mailer from this reference site. It is working fine on local there is no error. I also added {config.action_mailer.delivery_method = :smtp} with did smtp settings and deployed on heroku,

but now its giving error

We're sorry, but something went wrong. Please help.

Upvotes: 0

Views: 5097

Answers (2)

Amit Suroliya
Amit Suroliya

Reputation: 1535

For sending mail in production environment, do following thing -

 1. In config/environments/production.rb

   config.action_mailer.delivery_method = :smtp
   config.action_mailer.smtp_settings = {
     address: 'smtp.mail.com',
     port: 587,
     domain: 'YOUR_DOMAIN_GOES_HERE',
     user_name: 'YOUR_EMAIL_ID_GOES_HERE',
     password: 'YOUR_PASSWORD_GOES_HERE',
     authentication: 'plain',
     enable_starttls_auto: true }

and deploy this change on heroku and if you again found any error there, please check - heroku stack:set cedar-14

then again deploy on heroku - git push heroku master.

Try it.

Upvotes: 2

spickermann
spickermann

Reputation: 106912

The Heroku platform itself doesn’t provide an email service. You need to use external services. Read their documentation about how to send emails from your app.

Upvotes: 1

Related Questions