Search code examples
ruby-on-railsherokugmailactionmailer

ActionMailer Emails Failing-Cancel Current Process


My app is attempting to send email notifications using ActionMailer, but all emails are failing.

Here is the error: "Too many login attempts, please try again later. om8sm998783qeb.4 - gsmtp"

I want to kill all of the emails that are trying to be sent, does anyone know a way to do this?

The email that is being used is a gmail, my app is hosted on Heroku. I know I have emails configured properly, it isn't something in my code 100%.


Solution

  • If you're trying to temporarily stop email deliveries in your app, you can set the following action mailer configuration to false.

    # specifies whether mail will actually be delivered and is true by default. 
    # It can be convenient to set it to false for testing.
    config.action_mailer.perform_deliveries = false
    

    If you want to instead queue them up, you could use something like DelayedJob (https://github.com/collectiveidea/delayed_job) to queue them into the database. By default, it will retry failed deliveries on a progressive back-off delay.