{"id":18084858,"url":"https://github.com/jwodder/eletter","last_synced_at":"2025-04-12T20:10:09.434Z","repository":{"id":57426021,"uuid":"346061402","full_name":"jwodder/eletter","owner":"jwodder","description":"Simple e-mail composition \u0026 decomposition","archived":false,"fork":false,"pushed_at":"2025-04-01T02:14:29.000Z","size":210,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T20:09:54.918Z","etag":null,"topics":["available-on-pypi","e-mail","email","emailmessage","message","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jwodder.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-09T15:56:02.000Z","updated_at":"2025-01-23T14:41:51.000Z","dependencies_parsed_at":"2023-01-31T02:01:06.365Z","dependency_job_id":"504b0211-32ec-4c19-bc6f-9ed14cf1f1f0","html_url":"https://github.com/jwodder/eletter","commit_stats":{"total_commits":116,"total_committers":1,"mean_commits":116.0,"dds":0.0,"last_synced_commit":"37f1264345a84e3a124209802646cc8a22c132b8"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwodder%2Feletter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwodder%2Feletter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwodder%2Feletter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwodder%2Feletter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jwodder","download_url":"https://codeload.github.com/jwodder/eletter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248625493,"owners_count":21135513,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["available-on-pypi","e-mail","email","emailmessage","message","python"],"created_at":"2024-10-31T15:08:26.800Z","updated_at":"2025-04-12T20:10:09.402Z","avatar_url":"https://github.com/jwodder.png","language":"Python","readme":"|repostatus| |ci-status| |coverage| |pyversions| |license|\n\n.. |repostatus| image:: https://www.repostatus.org/badges/latest/active.svg\n    :target: https://www.repostatus.org/#active\n    :alt: Project Status: Active — The project has reached a stable, usable\n          state and is being actively developed.\n\n.. |ci-status| image:: https://github.com/jwodder/eletter/actions/workflows/test.yml/badge.svg\n    :target: https://github.com/jwodder/eletter/actions/workflows/test.yml\n    :alt: CI Status\n\n.. |coverage| image:: https://codecov.io/gh/jwodder/eletter/branch/master/graph/badge.svg\n    :target: https://codecov.io/gh/jwodder/eletter\n\n.. |pyversions| image:: https://img.shields.io/pypi/pyversions/eletter.svg\n    :target: https://pypi.org/project/eletter/\n\n.. |license| image:: https://img.shields.io/github/license/jwodder/eletter.svg\n    :target: https://opensource.org/licenses/MIT\n    :alt: MIT License\n\n`GitHub \u003chttps://github.com/jwodder/eletter\u003e`_\n| `PyPI \u003chttps://pypi.org/project/eletter/\u003e`_\n| `Documentation \u003chttps://eletter.readthedocs.io\u003e`_\n| `Issues \u003chttps://github.com/jwodder/eletter/issues\u003e`_\n| `Changelog \u003chttps://github.com/jwodder/eletter/blob/master/CHANGELOG.md\u003e`_\n\n``eletter`` provides functionality for constructing \u0026 deconstructing\n``email.message.EmailMessage`` instances without having to touch the needlessly\ncomplicated ``EmailMessage`` class itself.  A simple function enables\ncomposition of e-mails with text and/or HTML bodies plus attachments, and\nclasses are provided for composing more complex multipart e-mails.\n\n\nInstallation\n============\n``eletter`` requires Python 3.8 or higher.  Just use `pip\n\u003chttps://pip.pypa.io\u003e`_ for Python 3 (You have pip, right?) to install\n``eletter`` and its dependencies::\n\n    python3 -m pip install eletter\n\n\nExamples\n========\n\nConstructing an e-mail with the ``compose()`` function:\n\n.. code:: python\n\n    import eletter\n\n    TEXT = (\n        \"Oh my beloved!\\n\"\n        \"\\n\"\n        \"Wilt thou dine with me on the morrow?\\n\"\n        \"\\n\"\n        \"We're having hot pockets.\\n\"\n        \"\\n\"\n        \"Love, Me\\n\"\n    )\n\n    HTML = (\n        \"\u003cp\u003eOh my beloved!\u003c/p\u003e\\n\"\n        \"\u003cp\u003eWilt thou dine with me on the morrow?\u003c/p\u003e\\n\"\n        \"\u003cp\u003eWe're having \u003cstrong\u003ehot pockets\u003c/strong\u003e.\u003c/p\u003e\\n\"\n        \"\u003cp\u003e\u003cem\u003eLove\u003c/em\u003e, Me\u003c/p\u003e\\n\"\n    )\n\n    with open(\"hot-pocket.png\", \"rb\") as fp:\n        picture = eletter.BytesAttachment(\n            content=fp.read(),\n            filename=\"enticement.png\",\n            content_type=\"image/png\",\n        )\n\n    msg = eletter.compose(\n        subject=\"Meet Me\",\n        from_=\"me@here.qq\",\n        to=[eletter.Address(\"My Dear\", \"my.beloved@love.love\")],\n        text=TEXT,\n        html=HTML,\n        attachments=[picture],\n    )\n\n``msg`` can then be sent like any other ``EmailMessage``, say, by using\noutgoing_.\n\n.. _outgoing: https://github.com/jwodder/outgoing\n\nFor more complex e-mails, a set of classes is provided.  Here is the equivalent\nof the HTML-with-image e-mail with alternative plain text version from the\n``email`` `examples page`__ in the Python docs:\n\n__ https://docs.python.org/3/library/email.examples.html\n\n.. code:: python\n\n    from email.utils import make_msgid\n    import eletter\n\n    text = eletter.TextBody(\n        \"Salut!\\n\"\n        \"\\n\"\n        \"Cela ressemble à un excellent recipie[1] déjeuner.\\n\"\n        \"\\n\"\n        \"[1] http://www.yummly.com/recipe/Roasted-Asparagus-Epicurious-203718\\n\"\n        \"\\n\"\n        \"--Pepé\\n\"\n    )\n\n    asparagus_cid = make_msgid()\n\n    html = eletter.HTMLBody(\n        \"\u003chtml\u003e\\n\"\n        \"  \u003chead\u003e\u003c/head\u003e\\n\"\n        \"  \u003cbody\u003e\\n\"\n        \"    \u003cp\u003eSalut!\u003c/p\u003e\\n\"\n        \"    \u003cp\u003eCela ressemble à un excellent\\n\"\n        '        \u003ca href=\"http://www.yummly.com/recipe/Roasted-Asparagus-'\n        'Epicurious-203718\"\u003e\\n'\n        \"            recipie\\n\"\n        \"        \u003c/a\u003e déjeuner.\\n\"\n        \"    \u003c/p\u003e\\n\"\n        f'    \u003cimg src=\"cid:{asparagus_cid[1:-1]}\" /\u003e\\n'\n        \"  \u003c/body\u003e\\n\"\n        \"\u003c/html\u003e\\n\"\n    )\n\n    image = eletter.BytesAttachment.from_file(\n        \"roasted-asparagus.jpg\",\n        inline=True,\n        content_id=asparagus_cid,\n    )\n\n    msg = (text | (html ^ image)).compose(\n        subject=\"Ayons asperges pour le déjeuner\",\n        from_=eletter.Address(\"Pepé Le Pew\", \"pepe@example.com\"),\n        to=[\n            eletter.Address(\"Penelope Pussycat\", \"penelope@example.com\"),\n            eletter.Address(\"Fabrette Pussycat\", \"fabrette@example.com\"),\n        ],\n    )\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwodder%2Feletter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjwodder%2Feletter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwodder%2Feletter/lists"}