lathermail


Namelathermail JSON
Version 0.4.2 PyPI version JSON
download
home_pagehttps://github.com/reclosedev/lathermail/
SummarySMTP Server with API for email testing inspired by mailtrap and maildump
upload_time2020-08-21 11:47:30
maintainer
docs_urlNone
authorRoman Haritonov
requires_python
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. image:: https://travis-ci.org/reclosedev/lathermail.svg?branch=master
    :target: https://travis-ci.org/reclosedev/lathermail

.. image:: https://coveralls.io/repos/reclosedev/lathermail/badge.svg?branch=master&service=github
    :target: https://coveralls.io/github/reclosedev/lathermail?branch=master

lathermail
==========

SMTP Server with API for email testing inspired by `mailtrap <https://mailtrap.io/>`_ and
`maildump <https://github.com/ThiefMaster/maildump>`_

Can store messages in MongoDB or any SQLAlchemy supported DB (e.g., sqlite). Supports Python 2.7, 3.4, 3.5, pypy.

Contains simple UI interface (AngularJS) to navigate and manage received messages.

Available API clients:

    * Python API client `lathermail_client <https://github.com/reclosedev/lathermail_client>`_
      (`PyPI <https://pypi.python.org/pypi/lathermail_client/>`_).

Usage::

    $ virtualenv venv  # or mkvirutalenv lathermail
    $ . venv/bin/activate
    $ pip install lathermail
    $ lathermail --help

    usage: lathermail [-h] [--db-uri DB_URI] [--api-host API_HOST]
                      [--api-port API_PORT] [--smtp-host SMTP_HOST]
                      [--smtp-port SMTP_PORT]

    optional arguments:
      -h, --help            show this help message and exit
      --db-uri DB_URI       DB URI, e.g. mongodb://localhost/lathermail,
                            sqlite:////tmp/my.db (default:
                            sqlite:///~/.lathermail.db)
      --api-host API_HOST   API Host (default: 127.0.0.1)
      --api-port API_PORT   API port (default: 5000)
      --smtp-host SMTP_HOST
                            SMTP host (default: 127.0.0.1)
      --smtp-port SMTP_PORT
                            SMTP port (default: 2525)


It will start SMTP server and API server in single process.
Also UI interface is available at API port (http://127.0.0.1:5000 by default)

Inboxes are identified by SMTP user/password pairs. lathermail intended to be used in single project environment.

To send email, just use SMTP client with auth support.


API
---

To request API, you must provide headers:

* ``X-Mail-Password`` - same as SMTP password
* ``X-Mail-Inbox`` - same as SMTP user. Optional, work with all inboxes if not specified

**GET /api/0/inboxes/**

Returns list of inboxes for passed ``X-Mail-Password``::

    {
        "inbox_list": [
            "first",
            "second",
            "third"
        ],
        "inbox_count": 3
    }


**GET /api/0/messages/<message_id>**

Returns single message. Example::

    {
        "message_info": {
            "message_raw": "Content-Type: multipart/mixed; boundary=\"===============3928630509694630745==...",
            "password": "password",
            "sender": {
                "name": "Me",
                "address": "asdf@exmapl.com"
            },
            "recipients": [
                {
                    "name": "Rcpt1",
                    "address": "rcpt1@example.com"
                },
                {
                    "name": "Rcpt2",
                    "address": "rcpt2@example.com"
                },
                {
                    "name": "",
                    "address": "rcpt3@example.com"
                }
            ],
            "recipients_raw": "=?utf-8?q?Rcpt1?= <rcpt1@example.com>,\n =?utf-8?q?Rcpt2?= <rcpt2@example.com>, rcpt3@example.com",
            "created_at": "2014-06-24T15:28:35.045000+00:00",
            "sender_raw": "Me <asdf@exmapl.com>",
            "parts": [
                {
                    "index": 0,
                    "body": "you you \u043f\u0440\u0438\u0432\u0435\u0442 2",
                    "is_attachment": false,
                    "charset": "utf-8",
                    "filename": null,
                    "type": "text/plain",
                    "size": 16
                },
                {
                    "index": 1,
                    "body": null,
                    "is_attachment": true,
                    "charset": null,
                    "filename": "t\u0430\u0441\u0434est.txt",
                    "type": "application/octet-stream",
                    "size": 12
                }
            ],
            "inbox": "inbox",
            "_id": "53a960e3312f9156b7c92c5b",
            "subject": "Test subject \u0445\u044d\u043b\u043b\u043e\u0443 2",
            "read": false
        }
    }

Attachments in message have ``body`` = null. To download file, use following method.


**GET /api/0/messages/<message_id>/attachments/<attachment_index>**

Returns file from message. Works in browsers.


**GET /api/0/messages/**

Returns messages according to optional filters:

* ``sender.name`` - Name of sender
* ``sender.address`` - Email of sender
* ``recipients.name`` - Name of any of recipients
* ``recipients.address`` - Email of any of recipients
* ``subject`` - Message subject
* Add ``_contains`` suffix to any field above to search substring match,
  e.g.: ``subject_contains``, ``recipients.address_contains``
* ``created_at_lt`` - Filter messages created before this ISO formatted datetime
* ``created_at_gt`` - Filter messages created after this ISO formatted datetime
* ``read`` - Return only read emails when `True` or unread when `False`. All emails returned by default

Example::

    {
        "message_count": 3,
        "message_list": [
            {"_id": ..., "parts": [...], ...},  // same as single message
            {...},
            {...}
        ]
    }

**DELETE /api/0/messages/<message_id>**

Deletes single message

**DELETE /api/0/messages/**

Deletes all messages in inbox. Also, you can filter deletable messages like in **GET /api/0/**


Configuration
-------------
Copy lathermail.conf.example, modify it, export environment variable before starting::

    $ export LATHERMAIL_SETTINGS=/path/to/lathermail.conf
    $ lathermail


To run tests::

    $ python -m tests


.. :changelog:

Changelog
---------

0.4.1 (2017-02-06)
++++++++++++++++++
* [UI] Add button to delete single or all messages


0.4.0 (2017-02-06)
++++++++++++++++++
* Add ``_contains`` filters
* Fix error with simple text format emails


0.3.1 (2016-09-02)
++++++++++++++++++
* Proper fix for ``message_from_string`` on Python 2

0.3.0 (2016-09-01)
++++++++++++++++++
* HTML multipart support (#2, #3)
* Fix multipart binary messages



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/reclosedev/lathermail/",
    "name": "lathermail",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Roman Haritonov",
    "author_email": "reclosedev@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/e5/db/4dcab44dd79f4d57cd4c0afa22ccb754dd383d6d3e3c677d6ac0e44c5219/lathermail-0.4.2.tar.gz",
    "platform": "",
    "description": ".. image:: https://travis-ci.org/reclosedev/lathermail.svg?branch=master\n    :target: https://travis-ci.org/reclosedev/lathermail\n\n.. image:: https://coveralls.io/repos/reclosedev/lathermail/badge.svg?branch=master&service=github\n    :target: https://coveralls.io/github/reclosedev/lathermail?branch=master\n\nlathermail\n==========\n\nSMTP Server with API for email testing inspired by `mailtrap <https://mailtrap.io/>`_ and\n`maildump <https://github.com/ThiefMaster/maildump>`_\n\nCan store messages in MongoDB or any SQLAlchemy supported DB (e.g., sqlite). Supports Python 2.7, 3.4, 3.5, pypy.\n\nContains simple UI interface (AngularJS) to navigate and manage received messages.\n\nAvailable API clients:\n\n    * Python API client `lathermail_client <https://github.com/reclosedev/lathermail_client>`_\n      (`PyPI <https://pypi.python.org/pypi/lathermail_client/>`_).\n\nUsage::\n\n    $ virtualenv venv  # or mkvirutalenv lathermail\n    $ . venv/bin/activate\n    $ pip install lathermail\n    $ lathermail --help\n\n    usage: lathermail [-h] [--db-uri DB_URI] [--api-host API_HOST]\n                      [--api-port API_PORT] [--smtp-host SMTP_HOST]\n                      [--smtp-port SMTP_PORT]\n\n    optional arguments:\n      -h, --help            show this help message and exit\n      --db-uri DB_URI       DB URI, e.g. mongodb://localhost/lathermail,\n                            sqlite:////tmp/my.db (default:\n                            sqlite:///~/.lathermail.db)\n      --api-host API_HOST   API Host (default: 127.0.0.1)\n      --api-port API_PORT   API port (default: 5000)\n      --smtp-host SMTP_HOST\n                            SMTP host (default: 127.0.0.1)\n      --smtp-port SMTP_PORT\n                            SMTP port (default: 2525)\n\n\nIt will start SMTP server and API server in single process.\nAlso UI interface is available at API port (http://127.0.0.1:5000 by default)\n\nInboxes are identified by SMTP user/password pairs. lathermail intended to be used in single project environment.\n\nTo send email, just use SMTP client with auth support.\n\n\nAPI\n---\n\nTo request API, you must provide headers:\n\n* ``X-Mail-Password`` - same as SMTP password\n* ``X-Mail-Inbox`` - same as SMTP user. Optional, work with all inboxes if not specified\n\n**GET /api/0/inboxes/**\n\nReturns list of inboxes for passed ``X-Mail-Password``::\n\n    {\n        \"inbox_list\": [\n            \"first\",\n            \"second\",\n            \"third\"\n        ],\n        \"inbox_count\": 3\n    }\n\n\n**GET /api/0/messages/<message_id>**\n\nReturns single message. Example::\n\n    {\n        \"message_info\": {\n            \"message_raw\": \"Content-Type: multipart/mixed; boundary=\\\"===============3928630509694630745==...\",\n            \"password\": \"password\",\n            \"sender\": {\n                \"name\": \"Me\",\n                \"address\": \"asdf@exmapl.com\"\n            },\n            \"recipients\": [\n                {\n                    \"name\": \"Rcpt1\",\n                    \"address\": \"rcpt1@example.com\"\n                },\n                {\n                    \"name\": \"Rcpt2\",\n                    \"address\": \"rcpt2@example.com\"\n                },\n                {\n                    \"name\": \"\",\n                    \"address\": \"rcpt3@example.com\"\n                }\n            ],\n            \"recipients_raw\": \"=?utf-8?q?Rcpt1?= <rcpt1@example.com>,\\n =?utf-8?q?Rcpt2?= <rcpt2@example.com>, rcpt3@example.com\",\n            \"created_at\": \"2014-06-24T15:28:35.045000+00:00\",\n            \"sender_raw\": \"Me <asdf@exmapl.com>\",\n            \"parts\": [\n                {\n                    \"index\": 0,\n                    \"body\": \"you you \\u043f\\u0440\\u0438\\u0432\\u0435\\u0442 2\",\n                    \"is_attachment\": false,\n                    \"charset\": \"utf-8\",\n                    \"filename\": null,\n                    \"type\": \"text/plain\",\n                    \"size\": 16\n                },\n                {\n                    \"index\": 1,\n                    \"body\": null,\n                    \"is_attachment\": true,\n                    \"charset\": null,\n                    \"filename\": \"t\\u0430\\u0441\\u0434est.txt\",\n                    \"type\": \"application/octet-stream\",\n                    \"size\": 12\n                }\n            ],\n            \"inbox\": \"inbox\",\n            \"_id\": \"53a960e3312f9156b7c92c5b\",\n            \"subject\": \"Test subject \\u0445\\u044d\\u043b\\u043b\\u043e\\u0443 2\",\n            \"read\": false\n        }\n    }\n\nAttachments in message have ``body`` = null. To download file, use following method.\n\n\n**GET /api/0/messages/<message_id>/attachments/<attachment_index>**\n\nReturns file from message. Works in browsers.\n\n\n**GET /api/0/messages/**\n\nReturns messages according to optional filters:\n\n* ``sender.name`` - Name of sender\n* ``sender.address`` - Email of sender\n* ``recipients.name`` - Name of any of recipients\n* ``recipients.address`` - Email of any of recipients\n* ``subject`` - Message subject\n* Add ``_contains`` suffix to any field above to search substring match,\n  e.g.: ``subject_contains``, ``recipients.address_contains``\n* ``created_at_lt`` - Filter messages created before this ISO formatted datetime\n* ``created_at_gt`` - Filter messages created after this ISO formatted datetime\n* ``read`` - Return only read emails when `True` or unread when `False`. All emails returned by default\n\nExample::\n\n    {\n        \"message_count\": 3,\n        \"message_list\": [\n            {\"_id\": ..., \"parts\": [...], ...},  // same as single message\n            {...},\n            {...}\n        ]\n    }\n\n**DELETE /api/0/messages/<message_id>**\n\nDeletes single message\n\n**DELETE /api/0/messages/**\n\nDeletes all messages in inbox. Also, you can filter deletable messages like in **GET /api/0/**\n\n\nConfiguration\n-------------\nCopy lathermail.conf.example, modify it, export environment variable before starting::\n\n    $ export LATHERMAIL_SETTINGS=/path/to/lathermail.conf\n    $ lathermail\n\n\nTo run tests::\n\n    $ python -m tests\n\n\n.. :changelog:\n\nChangelog\n---------\n\n0.4.1 (2017-02-06)\n++++++++++++++++++\n* [UI] Add button to delete single or all messages\n\n\n0.4.0 (2017-02-06)\n++++++++++++++++++\n* Add ``_contains`` filters\n* Fix error with simple text format emails\n\n\n0.3.1 (2016-09-02)\n++++++++++++++++++\n* Proper fix for ``message_from_string`` on Python 2\n\n0.3.0 (2016-09-01)\n++++++++++++++++++\n* HTML multipart support (#2, #3)\n* Fix multipart binary messages\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "SMTP Server with API for email testing inspired by mailtrap and maildump",
    "version": "0.4.2",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "69bbf5b12ea948aab6b0d02505b11ed4",
                "sha256": "266e3beca557b5becbb8a04ca85981efebf30290a662b2041346593e29db1344"
            },
            "downloads": -1,
            "filename": "lathermail-0.4.2-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "69bbf5b12ea948aab6b0d02505b11ed4",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 25028,
            "upload_time": "2020-08-21T11:47:29",
            "upload_time_iso_8601": "2020-08-21T11:47:29.134782Z",
            "url": "https://files.pythonhosted.org/packages/0d/6e/e14c4b54338d806661511f3d918e7aa000d7dfb4a44e7f83d9552d53e928/lathermail-0.4.2-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "2cc834b41e259da4e0076d5dbe24cee8",
                "sha256": "14da49d1e6d7316d53608716e250059b9b38594afeb83752be2238e029515c0c"
            },
            "downloads": -1,
            "filename": "lathermail-0.4.2.tar.gz",
            "has_sig": false,
            "md5_digest": "2cc834b41e259da4e0076d5dbe24cee8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 21878,
            "upload_time": "2020-08-21T11:47:30",
            "upload_time_iso_8601": "2020-08-21T11:47:30.994092Z",
            "url": "https://files.pythonhosted.org/packages/e5/db/4dcab44dd79f4d57cd4c0afa22ccb754dd383d6d3e3c677d6ac0e44c5219/lathermail-0.4.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2020-08-21 11:47:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": null,
    "github_project": "reclosedev",
    "error": "Could not fetch GitHub repository",
    "lcname": "lathermail"
}
        
Elapsed time: 0.14792s