Metadata-Version: 2.0
Name: localmail
Version: 0.4.0
Summary: Test SMTP/IMAP server for local integration testing
Home-page: https://launchpad.net/localmail
Author: Simon Davy
Author-email: simon.davy@canonical.com
License: GPLv3
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Framework :: Twisted
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Intended Audience :: Developers
Classifier: Operating System :: POSIX
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Communications :: Email
Classifier: Topic :: Communications :: Email :: Mail Transport Agents
Classifier: Topic :: Communications :: Email :: Post-Office :: IMAP
Classifier: Topic :: Software Development :: Testing
Requires-Dist: Twisted (>=11.0.0)
Requires-Dist: jinja2 (>=2.0.0)

Localmail
=========

For local people.

Localmail is an SMTP and IMAP server that stores 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. It can also be used to test SMTP/IMAP client code.

Features:

  * Fast and robust IMAP/SMTP implementations, including multipart
    messages and unicode support.

  * Includes simple HTTP interface for reading messages, which is useful for
    checking html emails.

  * Compatible with python's stdlib client, plus clients like mutt and
    thunderbird.

  * Authentication is supported but completely ignored, all message go in
    single mailbox.

  * Messages not persisted by default, and will be lost on shutdown.
    Optionally, you can log messages to disk in mbox format.

Missing features/TODO:

  * SSL support

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


Running localmail
-----------------

.. code-block:: bash

    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.

.. code-block:: bash

    twistd -n localmail


You can pass in arguments to control parameters.

.. code-block:: bash

   twistd localmail --imap <port> --smtp <port> --http <port> --file localmail.mbox


You can have localmail use random ports if you like. The port numbers will be logged.
TODO: enable writing random port numbers to a file.

.. code-block:: bash

   twisted -n localmail --random


Embedding
---------

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

.. code-block:: python

    import threading
    import localmail

    thread = threading.Thread(
       target=localmail.run,
       args=(2025, 2143, 8880, 'localmail.mbox')
    )
    thread.start()

    ...

    localmail.shutdown_thread(thread)

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

If you want to use random ports, you can pass a callback that will have the
ports the service is listening on.

.. code-block:: python

    import threading
    import localmail

    def report(smtp, imap, http):
        """do stuff with ports"""

    thread = threading.Thread(
       target=localmail.run,
       args=(0, 0, 0, None, report)
    )
    thread.start()




.. :changelog:

History
=======

0.4 (2014-0-??)
----------------

 * support for using random port numbers
 * available as a universal wheel, general packaging improvements
 * Simple HTTP interface for browsing mail
 * Support writing to mbox file
 * Fixed date to work with mutt, example muttrc included in package.


0.3 (2013-05-24)
----------------

 * Multipart message support [via Ed Jannoo]
 * IMAP UID support
 * Support python 2.6, 2.7 and pypy, tested via tox


0.2 (2012-11-13)
----------------

 * Initial public release
 * Basic SMTP/IMAP server



Credits
=======

“localmail” is written and maintained by Simon Davy


Contributors
------------

The following people contributed directly or indirectly to this project:

- `Ed Jannoo <ed@azordi.com>`


