nope
nope

Reputation: 197

Python / Django | How to store sent emails?

I was wondering how can I store sent emails I have a send_email() function in a pre_save() and now I want to store the emails that have been sent so that I can check when an email was sent and if it was sent at all.

Upvotes: 3

Views: 1053

Answers (3)

Stephen Paulger
Stephen Paulger

Reputation: 5343

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.

Upvotes: 2

Toby D
Toby D

Reputation: 1421

Another way to look at it: send the mail to your backup email account ex: [email protected]. 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.

Upvotes: 2

Wtower
Wtower

Reputation: 19902

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.

Upvotes: 5

Related Questions