Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

pypm install localmail

How to install localmail

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install localmail
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.3Never BuiltWhy not?
0.2 Available View build log
Windows (64-bit)
Mac OS X (10.5+)
0.3Never BuiltWhy not?
0.2 Available View build log
Linux (32-bit)
0.3Never BuiltWhy not?
0.2 Available View build log
Linux (64-bit)
0.3 Available View build log
0.2 Available View build log
Lastest release
version 0.3 on Jan 9th, 2014


Localmail is SMTP and IMAP server that writes/reads all messages into a single in-memory mailbox. It is designed to be used to speed up running test suites on systems that send email, such as new account sign up emails with confirmation codes.

Authentication is supported but completely ignored, and all senders and receiver email addresses are treated the same. Messages are not persisted, and will be lost on shutdown.

  • no SSL support

WARNING: not a real SMTP/IMAP server - not for production usage.


pip install localmail


There are multiple ways to run localmail

twistd localmail

This will run localmail in the background, SMTP on port 2025 and IMAP on 2143, It will log to a file ./twistd.log. Use the -n option if you want to run in the foreground, like so.

twistd -n localmail

You can pass in arguments to control parameters.

twistd localmail --imap <port> --smtp <port> -l localmail.log

Alternatively, run via tac file:

twistd -y localmail.tac


If you want to embed localmail in another non-twisted program, such as test runner, do the following.

import threading
import localmail

thread = threading.Thread(target=localmail.run, args=(2025, 2143))



This will run the twisted reactor in a separate thread, and shut it down on exit.


python setup.py develop


The test suite is very simple, it uses the python stdlib imaplib and smtplib modules as clients, rather than twisted IMAP/SMTP, so it's more integration tests rather than unit tests.

python setup.py test [-s localmail.tests.test_localmail.SomeTestCase.test_something]

Subscribe to package updates

Last updated Jan 9th, 2014

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.