Python / Django | How do I store sent emails?

I was wondering how can I store sent emails? I have a function send_email()

in pre_save()

and now I want to save sent emails so that I can check when the email was sent and if it was sent at all.

+3


source to share


3 answers


I think the easiest way, before messing up middleware or whatever, is to simply create a model for your registered emails and add a new entry if the submission was successful.



+5


source


Another way to look at this is to send an email to the backup email account ex: backup@yourdomain.com. This way you can save email, check if email is sent or not.



Also, having an additional model for registered emails is the way to go.

+2


source


I would suggest using an existing django mail app.

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

I think it is better not to send email directly from views, so your views won't block if your mail server is down, so another reason to use something like this.

+2


source







All Articles