Search code examples
ruby-on-railsherokugmail

Net::SMTPAuthenticationError ruby on heroku with gmail works but fails again


I have problems sending mail from a ruby production app on heroku by a gmail smtp account.

Here i found the solution

When i apply the solution all works wel, but after a while the problems comes back.

Do i have to set something in my google account to make it permanent ?

I think it has to do with the fact that i am using a free heroku account. The servers stops after a while an perhaps has to login in gmail when it starts up again.


Solution

  • There's no way to make it permanent because Gmail doesn't want its service to be used to send out automated e-mails(*).

    There are some providers that will make it much easier for you:

    or take your pick, because the market seem to be pretty saturated: https://duckduckgo.com/?q=e-mail+delivery+service&ia=web

    (*) What I suspect they do (though I could not find info about it) is that they can see if "same e-mails" are sent within short intervals.

    You might try your luck (if it makes sens, when for example it's a toy project) to alter each e-mail contents to make it seem like different e-mail each time. But it will be just easier to go with free option in any other providers that actually want you to use it in your app.