Heroku not sending email with Gmail SMTP

You have to check two important things when you want to send emails via Gmail smtp:

  1. Your apps configuration:

    • host: smtp.gmail.com
    • port: 587 or 465 (587 for tls, 465 for ssl)
    • protocol: tls or ssl
    • user: [email protected]
    • password: YOUR_PASSWORD
  2. The given Gmail account settings:

    • If you've turned on 2-Step Verification for your account, you might need to enter an App password.
    • Without 2-Step Verification:
      1. Allow less secure apps access to your account.
      2. Visit http://www.google.com/accounts/DisplayUnlockCaptcha and sign in with your Gmail username and password.

I was running into a similar issue. The problem I was having was that I wasn't telling Heroku to copy my configuration variables over to Heroku as environment variables. I used the figaro gem and the smtp email worked after entering this command:

figaro heroku:set -e production

I would recommend that you make sure that you are using the correct gmail username and password.

For more information checkout this tutorial. I can confirm that it works http://usingname.space/2015/07/25/gmail-smtp-ruby-on-rails-actionmailer-and-you/