markdownmail


Namemarkdownmail JSON
Version 0.11.0 PyPI version JSON
download
home_pagehttps://gitlab.com/yaal/markdownmail
SummaryE-mail with text and html content provided with markdown
upload_time2023-09-12 07:26:41
maintainer
docs_urlNone
authorYaal Team
requires_python
licenseMIT
keywords mail markdown yaal
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            MarkdownMail
============

Purpose
-------

Send e-mails with generated html content.

The content has to be written in Markdown syntax. The text part of the e-mail
will be filled verbatim; the html part will be a converted HTML from the
Markdown content.

![E-mail rendering for the user (HTML part)](https://www.yaal.fr/media/softwares/markdownmail-screenshot.png)

Install
-------

`$ pip install markdownmail`


Basic Usage
-----------

```python
import markdownmail

CONTENT = u"""
SPAMS AND EGGS
==============

This is a demo with a list:

1. Spam
2. Second spam
3. ...and eggs
"""

email = markdownmail.MarkdownMail(
    from_addr=u'alice@example.org',
    to_addr=u'bob@example.org',
    subject=u'MarkdownMail demo',
    content=CONTENT
)

email.send('localhost')
```

Content must be unicode.


More infos
----------

Additional informations are addable:

```python
email = markdownmail.MarkdownMail(
    from_addr=(u'alice@example.org', u'Alice'),
    to_addr=(u'bob@example.org', u'Bob'),
    subject=u'MarkdownMail demo',
    content=CONTENT
)
```

`cc_addr` and `bcc_addr` are optional.
The `from_addr`, `to_addr`, `cc_addr` and `bcc_addr` parameters are the same as
[Enveloppe](http://pypi.org/pypi/Envelopes/) library.


Change SMTP port:

```python
email.send("example.org", port=3325)
```

Change SMTP login and password:

```python
email.send("example.org", login="user", password="password")
```

Use TLS:

```python
email.send("example.org", tls=True)
```

Style
-----

A default CSS is automatically added to the e-mail. It includes a font sans serif and minor improvements.

To override the default CSS, pass a string including the style to the `css` optional parameter of `MardownMail`:

```python
import markdownmail

email = markdownmail.MarkdownMail(
    from_addr=u'alice@example.org',
    to_addr=u'bob@example.org',
    subject=u'MarkdownMail demo',
    content="CONTENT",
    css="font-family:monospace; color:green;"
)
```

Run tests
---------

Tox is automatically installed in virtualenvs before executing the tests.
Execute them with:

`$ python setup.py test`


Disable sending e-mails in your tests
-------------------------------------

The e-mail is not send if the parameter passed to `send()` method is an instance of `NullServer`.

```python
email = markdownmail.MarkdownMail(
    #params
)

email.send(markdownmail.NullServer())
```

Assert about e-mails in your tests
----------------------------------

Subclassing `NullServer` allows to provide a custom behaviour in the `check()`
method:

```python
class MyServer(markdownmail.NullServer):
    def check(self, email):
        assert u'bob@example.org' == email.to_addr[0]

email.send(MyServer())
```


Useful links
------------

[Envelopes library](https://pypi.org/pypi/Envelopes/0.4)
(MardownMail is a wrapper around Envelopes library.)

[Markdown syntax](https://daringfireball.net/projects/markdown/syntax)

            

Raw data

            {
    "_id": null,
    "home_page": "https://gitlab.com/yaal/markdownmail",
    "name": "markdownmail",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "mail markdown yaal",
    "author": "Yaal Team",
    "author_email": "contact@yaal.fr",
    "download_url": "https://files.pythonhosted.org/packages/17/96/4e3bf15239b35415c39f74cfc40bfca564c740a528eca5bfb5dab89a7a88/markdownmail-0.11.0.tar.gz",
    "platform": null,
    "description": "MarkdownMail\n============\n\nPurpose\n-------\n\nSend e-mails with generated html content.\n\nThe content has to be written in Markdown syntax. The text part of the e-mail\nwill be filled verbatim; the html part will be a converted HTML from the\nMarkdown content.\n\n![E-mail rendering for the user (HTML part)](https://www.yaal.fr/media/softwares/markdownmail-screenshot.png)\n\nInstall\n-------\n\n`$ pip install markdownmail`\n\n\nBasic Usage\n-----------\n\n```python\nimport markdownmail\n\nCONTENT = u\"\"\"\nSPAMS AND EGGS\n==============\n\nThis is a demo with a list:\n\n1. Spam\n2. Second spam\n3. ...and eggs\n\"\"\"\n\nemail = markdownmail.MarkdownMail(\n    from_addr=u'alice@example.org',\n    to_addr=u'bob@example.org',\n    subject=u'MarkdownMail demo',\n    content=CONTENT\n)\n\nemail.send('localhost')\n```\n\nContent must be unicode.\n\n\nMore infos\n----------\n\nAdditional informations are addable:\n\n```python\nemail = markdownmail.MarkdownMail(\n    from_addr=(u'alice@example.org', u'Alice'),\n    to_addr=(u'bob@example.org', u'Bob'),\n    subject=u'MarkdownMail demo',\n    content=CONTENT\n)\n```\n\n`cc_addr` and `bcc_addr` are optional.\nThe `from_addr`, `to_addr`, `cc_addr` and `bcc_addr` parameters are the same as\n[Enveloppe](http://pypi.org/pypi/Envelopes/) library.\n\n\nChange SMTP port:\n\n```python\nemail.send(\"example.org\", port=3325)\n```\n\nChange SMTP login and password:\n\n```python\nemail.send(\"example.org\", login=\"user\", password=\"password\")\n```\n\nUse TLS:\n\n```python\nemail.send(\"example.org\", tls=True)\n```\n\nStyle\n-----\n\nA default CSS is automatically added to the e-mail. It includes a font sans serif and minor improvements.\n\nTo override the default CSS, pass a string including the style to the `css` optional parameter of `MardownMail`:\n\n```python\nimport markdownmail\n\nemail = markdownmail.MarkdownMail(\n    from_addr=u'alice@example.org',\n    to_addr=u'bob@example.org',\n    subject=u'MarkdownMail demo',\n    content=\"CONTENT\",\n    css=\"font-family:monospace; color:green;\"\n)\n```\n\nRun tests\n---------\n\nTox is automatically installed in virtualenvs before executing the tests.\nExecute them with:\n\n`$ python setup.py test`\n\n\nDisable sending e-mails in your tests\n-------------------------------------\n\nThe e-mail is not send if the parameter passed to `send()` method is an instance of `NullServer`.\n\n```python\nemail = markdownmail.MarkdownMail(\n    #params\n)\n\nemail.send(markdownmail.NullServer())\n```\n\nAssert about e-mails in your tests\n----------------------------------\n\nSubclassing `NullServer` allows to provide a custom behaviour in the `check()`\nmethod:\n\n```python\nclass MyServer(markdownmail.NullServer):\n    def check(self, email):\n        assert u'bob@example.org' == email.to_addr[0]\n\nemail.send(MyServer())\n```\n\n\nUseful links\n------------\n\n[Envelopes library](https://pypi.org/pypi/Envelopes/0.4)\n(MardownMail is a wrapper around Envelopes library.)\n\n[Markdown syntax](https://daringfireball.net/projects/markdown/syntax)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "E-mail with text and html content provided with markdown",
    "version": "0.11.0",
    "project_urls": {
        "Homepage": "https://gitlab.com/yaal/markdownmail"
    },
    "split_keywords": [
        "mail",
        "markdown",
        "yaal"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3a23b2432adbde84ba6f5facbf5b059b81de752d584b9f6909949a8c3e3f4301",
                "md5": "93f3c6e9932a58b2bf15f52612de0e83",
                "sha256": "7735145ab54d9692ba5b0de8d67dd20f044d3689c6f166d7cace2a2427742e4c"
            },
            "downloads": -1,
            "filename": "markdownmail-0.11.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "93f3c6e9932a58b2bf15f52612de0e83",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 8671,
            "upload_time": "2023-09-12T07:26:40",
            "upload_time_iso_8601": "2023-09-12T07:26:40.467509Z",
            "url": "https://files.pythonhosted.org/packages/3a/23/b2432adbde84ba6f5facbf5b059b81de752d584b9f6909949a8c3e3f4301/markdownmail-0.11.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "17964e3bf15239b35415c39f74cfc40bfca564c740a528eca5bfb5dab89a7a88",
                "md5": "b19260415d97b0258f9ff768d30712a0",
                "sha256": "ee3e9335647581eb7152b818d387baa499a86288870ad3f9097bb575bb794061"
            },
            "downloads": -1,
            "filename": "markdownmail-0.11.0.tar.gz",
            "has_sig": false,
            "md5_digest": "b19260415d97b0258f9ff768d30712a0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 9373,
            "upload_time": "2023-09-12T07:26:41",
            "upload_time_iso_8601": "2023-09-12T07:26:41.889035Z",
            "url": "https://files.pythonhosted.org/packages/17/96/4e3bf15239b35415c39f74cfc40bfca564c740a528eca5bfb5dab89a7a88/markdownmail-0.11.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-12 07:26:41",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "yaal",
    "gitlab_project": "markdownmail",
    "lcname": "markdownmail"
}
        
Elapsed time: 0.11507s