Any tips on testing email sending? Other than maybe creating a gmail account, especially for receiving those emails?
I would like to, maybe, store the emails locally, within a folder as they are sent.
Any tips on testing email sending? Other than maybe creating a gmail account, especially for receiving those emails?
I would like to, maybe, store the emails locally, within a folder as they are sent.
https://websocket.email provides a simple way to test email sending with minimal setup (you don't even need an account).
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!
Use Maildump.
https://github.com/ThiefMaster/maildump
However it requires Python 2.
Patching SMTPLib for testing purposes can help test sending mails without sending them.
If you have a TomCat server available, or other servlet engine, then a nice approach is "Post Hoc" which is a small server that looks to the application exactly like a SMTP server, but it includes a user interface that allows you to view and inspect the email messages that were sent. It is open source and freely available.
Find it at: Post Hoc GitHub Site
See the blog post: PostHoc: Testing Apps that Send Email
If you are into unit-testing the best solution is to use the In-memory backend provided by django.
Take the case of use it as a py.test fixture
In each test, the
mail.outbox
is reset with the server, so there are no side effects between tests.