Heroku Not Sending Email With Gmail Smtp

Can't send email using Gmail on Heroku

This is an active app I have had forever where the mail still works. Try changing the auth type to a symbol rather than a string. So :plain instead of 'plain'.

  config.action_mailer.smtp_settings = {
:enable_starttls_auto => true,
:address => 'smtp.gmail.com',
:port => 587,
:authentication => :plain,
:domain => 'blarg.com',
:user_name => 'info@blarge.com',
:password => 'password'

config.action_mailer.default_url_options = { :host => 'blarg.heroku.com' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default :charset => "utf-8"

Nodemailer Gmail SMTP not working on heroku

You can try using google apis oauth 2.0 and setting yourself as a tester and sending mail on your behalf docs

Laravel password reset email not sending using gmail on Heroku

Don't use Gmail in production¹.

Gmail isn't designed to act as an SMTP gateway for your application. Instead, use one of the many mail addons that Heroku recommends. Mailgun and SendGrid are both very popular options, but there are lots of others.

These tools are designed to send mail for applications. They'll be a lot less likely to reject your mail and, when configured properly, make it a lot less likely for your mail to get caught in spam filters. Most of them have walkthroughs for setting things up, and I encourage you to follow them. Make sure not to skip the SPF and DKIM anti-spam features.

I have read here that I have to hard-code the values inside app/mail.php instead of referencing the .env file because Heroku wouldn't recognize/understand this reference

'password' => env('MAIL_PASSWORD')

This is incorrect.

You say that you've set config variables on Heroku, and that populates the environment. The .env file is just a convenient local workaround for doing the same thing. Whichever mail addon you choose will automatically set one or more environment variables for you, and you should use those in your code.

¹You probably shouldn't be using it in development, either, but it's less of a problem there. I urge you to use something like Mailtrap (cloud) or Mailcatcher (local) instead.

Email for user confirmation not sending in production. Rails, Heroku, Gmail

Check this youtube video youtube.com/watch?v=INPqBOerfTw&t=63s

I prefer to use mandrill app instead of gmail

  config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "smtp.mandrillapp.com",
:port => 587,
:domain => 'www.xyz.com',
:user_name => 'xyz',
:password => 'xxx',
:authentication => :plain,
:enable_starttls_auto => true

Related Topics

Leave a reply