Search code examples
pythondjangoemailsmtpdjango-testing

Testing email sending in Django


I need to test that my Django application sends e-mails with correct content. I don't want to rely on external systems (like an ad-hoc gmail account), since I'm not testing the actual e-mail service...

I would like to, maybe, store the emails locally, within a folder as they are sent. Any tip on how to achieve it?


Solution

  • You can use a file backend for sending emails which is a very handy solution for development and testing; emails are not sent but stored in a folder you can specify!