[Django]-Python / Django | How to store sent emails?

5👍

I think the easiest way before messing up with middleware or whatever is to simply create a model for your logged emails and add a new record if send was successful.

👤Wtower

2👍

Another way to look at it: send the mail to your backup email account ex: backup@yourdomain.com. So you can store the email, check if the email is sent or not.

Other than that, having an extra model for logged emails is a way to go.

👤Toby D

2👍

I would suggest making use of an existing django mail app.

django-mailer may do the trick. It has a message log.

I think it is best not to send email directly from views, your views then won’t get blocked if your mail server happens not to be functioning, so that’s another reason to use something like this.

Leave a comment