Freelance System Operations/DevOps Engineer from Belgium. Mostly working AWS and Kubernetes. Also have some experience with Python, and learning some Golang when I find the time.
I do it a bit differently: I run PostFix on my servers, which is configured to use an external SMTP server as forwarder (can be GMail, SES, ...). Then I let my app deliver to my local SMTP server.
This has a few advantages:
App is no longer coupled to GMail settings
The most important one: mails will be queued on local server, in case remote SMTP goes down or is not available. Most SMTP servers already handle automatic retries, and dead mail queues out of the box.
If you do it within the Django app, I would suggest to add some message queue stuff (Celery) so SMTP calls don't block your app, or retry in case of failure.
I do it a bit differently: I run PostFix on my servers, which is configured to use an external SMTP server as forwarder (can be GMail, SES, ...). Then I let my app deliver to my local SMTP server.
This has a few advantages:
If you do it within the Django app, I would suggest to add some message queue stuff (Celery) so SMTP calls don't block your app, or retry in case of failure.
that's great thank you will try to implement this