Testing mail locally with the Google App Engine Development Web Server
The Google App Engine Mail API lets you easily send email from your applications. However, I found it difficult to test it locally when using the Development Web Server.
The documentation states that you can either use an existing SMTP provider or sendmail with the local server but the former solution didn't work for me with GMail or the SMTP server at my web host. And, from a quick Google search for sendmail, I got the impression that I should stay away from it.
In the end, I opted to use a simple Python-based SMTP server by Les Smithson to debug my mail calls locally.
It's very simple to use:
- Download the smtps.py script.
- In Terminal, change to the folder you downloaded the script into and run it with
python smtps.py <port number>
, replacing <port number> with the port you want the SMTP server to listen on. - Start your Google App Engine Dev Web Server with
dev_appserver.py --smtp_host=localhost --smtp_port=<port number>
.
That's it! Now test your Google App Engine application locally in the Development Web Server and the contents of email messages sent by your application will appear in the Terminal window running the SMTP server.
Comments
by Konrad Martin on 2009-04-02 10:47:15
by Aral on 2008-12-17 23:37:39
by Web Designer on 2008-10-22 11:21:35
by Nora on 2008-12-17 18:24:24
by How to Get Six Pack Fast on 2009-04-15 13:22:36
by Konrad Martin on 2009-04-03 18:33:29
by Konrad Martin on 2009-03-31 15:30:51
by aleksandar on 2009-08-17 22:46:06
by David Underhill on 2010-09-19 21:00:42
by Josh Rehman on 2012-03-07 18:45:47