Reputation: 175
is there any way to send a mail from python code via an external SMTP server with an app that is deployed on Heroku? (Without using one of Herokus add-ons)
Thanks in advance P.
Upvotes: 0
Views: 1963
Reputation: 33824
You can indeed use external SMTP providers to send email through Heroku (I do this on several of the apps I run). One thing to note, however, is that a lot of SMTP providers (Gmail, for example), will routinely block IPs from popular hosting providers (like Heroku) due to abuse.
This is a common issue that has been documented before.
That's why Heroku officially recommends using an email sending service like Mailgun, Sendgrid, etc. since they are dedicated email providers that are meant to be used by developers and won't block you, etc.
In short: your external SMTP provider is likely blocking the Heroku service. Check-in with them and see if you can either get the restriction removed or potentially used a real email sending service if you want guaranteed delivery.
Upvotes: 2