wxMailServer: GUI tool to help you with testing Django e-mails

26 views
Skip to first unread message

Michał Pasternak

unread,
Dec 19, 2013, 4:23:58 AM12/19/13
to django...@googlegroups.com
Hi,

I would like to announce a GUI app, written in wxPython, that I quickly assembled yesterday mainly using some code from StackOverflow and Google.

The app is called wxMailServer and all it does is: it acts as a mail server (it listens for traffic incoming at localhost port 25) and when an e-mail is received, it displays this e-mail, highlighting URL addresses in it and launching a web browser in case you click on any of those addresses. 

I found it very helpful to test my Django apps with it. The pattern "notify user by an e-mail with a link inside" is often used, and as I imagine, that there may be a lot of different approach to this idea, wxMailServer is one of possible implementations[*].

The GitHub repo is here: https://github.com/mpasternak/wxMailServer . Yes, the app is a quick hack and it does not display nicely formatted HTML e-mails with attachments yet, but on the other hand, I am not sending those with my Django apps yet. So, perhaps, rather please treat it as an example implementation of an idea. 

E-mail sending is getting harder and harder nowadays, with my VM unable to send e-mail because of local antivirus, and if I disable it, I get notices from Google about being on an IP that is not allowed to send e-mails. So, anyway, it looks harder and harder. Why do that, then? E-mail server running on localhost, displaying incoming e-mails should be the best tool to test if your app generates proper e-mails.

So, if wxMailServe ris a tool you need, get it and have fun with it. 

Regards,
Michael Pasternak



[*] - I once thought about creating a POP3 client for my tests, that would login into a real POP3 account and fetch the e-mails and check if there are any e-mails from my Django app, then click links on those, automatically. Fortunatley, I did not went that way, but it seemed interesting.

Arnold Krille

unread,
Dec 19, 2013, 3:57:08 PM12/19/13
to django...@googlegroups.com
Hi

On Thu, 19 Dec 2013 01:23:58 -0800 (PST) Michał Pasternak
<micha...@gmail.com> wrote:
> I would like to announce a GUI app, written in wxPython, that I
> quickly assembled yesterday mainly using some code from StackOverflow
> and Google.
>
> The app is called wxMailServer and all it does is: it acts as a mail
> server (it listens for traffic incoming at localhost port 25) and
> when an e-mail is received, it displays this e-mail, highlighting URL
> addresses in it and launching a web browser in case you click on any
> of those addresses.

An interesting idea. However, running a program that tries to open a
port <1024 results on security issues on modern machines. Only system
process are allowed (or should be allowed) to open ports there.
Luckily enough, if your software has an option to start with listening
on a different port, you can also set that port when telling django how
to send emails.

> E-mail sending is getting harder and harder nowadays, with my VM
> unable to send e-mail because of local antivirus, and if I disable
> it, I get notices from Google about being on an IP that is not
> allowed to send e-mails. So, anyway, it looks harder and harder. Why
> do that, then? E-mail server running on localhost, displaying
> incoming e-mails should be the best tool to test if your app
> generates proper e-mails.

"Sending emails" for testing? There is this email-backend in django
that just displays the messages on the console. Ideal for manual
testing.
And for automated testing (the only way to make sure you really always
send emails with the wanted content) you just look at mailbox.outbox as
described in django testing docs.

Lastly there are several thousand valid reasons for mailservers not to
accept un-authenticated email delivery from dail-ups and dynamic
ranges. (These mails are largely called spam and are sent by botnets.)

Have fun,

Arnold

PS: If you really want your local django to send mails to the outside
via google, you can just do smtp-authentication with your valid google
credentials...
signature.asc

Donald Casson

unread,
Dec 19, 2013, 9:48:01 PM12/19/13
to django...@googlegroups.com
Hi, 

While not as flash as a the guy driven approach.  You can use a simple python one liner to setup a test mail server that will display emails to the console. 

sudo python -m smtpd -n -c DebuggingServer localhost:25

Cheers
Don

Donald Casson

unread,
Dec 20, 2013, 1:28:19 AM12/20/13
to django...@googlegroups.com
Should be gui driven approach. :)
Reply all
Reply to author
Forward
0 new messages