Skip to main content

A Markdown-based HTML email API.

Project description

Eärendil

Eärendil is a Markdown-based HTML email API written in Python. It allows users to draft an email message in Markdown and send it as a rich email viewable as both HTML and plaintext.

My primary motivation for creating this library was the lack of good options for sending rich emails with an alternative plaintext message for recipients who may be using a dated email service. I think that providing a faithful alternative message is important, and that simply using the Markdown used to generate the HTML message as the alternative is insufficient. Markdown, while fairly human-readable compared to most markup languages, still contains redundant or unhelpful syntax that is better expressed differently in plaintext. For example, escape characters should be removed, as should heading and emphasis symbols.

Features

  • Renders Common Markdown messages into HTML.
  • Renders a subset of Markdown into plaintext.
  • Sends Markdown emails from either strings or files.

Planned Features

  • Bulk mailing functionality.
  • Support for rendering a greater subset of Markdown as plaintext.
  • Support for attachments.

Usage

To send Markdown-formatted emails using Eärendil, use either the send_markdown_emailor send_markdown_email_from_file functions. Here is an example that uses each:

from pathlib import Path
from smtplib import SMTP

from earendil import send_markdown_email, send_markdown_email_from_file

sender_email = "sender@gmail.com"
password = "password"
recipient = "receiver@example.com"

subject = "Example Subject"
message_path = Path("/path/to/markdown.md")
with message_path.open("r") as file:
    message = file.read()

with SMTP("smtp.gmail.com", 587) as server:
    server.starttls()
    server.login(sender_email, password)
    # Here, you can either use:
    send_markdown_email(server, sender_email, recipient, subject, message)
    # or, alternatively:
    send_markdown_email_from_file(server, sender_email, recipient, subject, message_path)

Installation

Requirements

Eärendil can run on any version of Python since 3.6.2 (inclusive). It also depends on the markdown library.

From PyPI

The easiest way to install Eärendil is to simply run the command pip3 install earendil-mail.

From Source

Alternatively, Eärendil can be installed from source by cloning this repository. To do so, run the following commands:

git clone https://github.com/ADSteele916/earendil
cd earendil
pip3 install .

Uninstallation

To uninstall, simply run the command pip3 uninstall earendil-mail

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

earendil_mail-0.1.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

earendil_mail-0.1.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file earendil_mail-0.1.0.tar.gz.

File metadata

  • Download URL: earendil_mail-0.1.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.8.8 Windows/10

File hashes

Hashes for earendil_mail-0.1.0.tar.gz
Algorithm Hash digest
SHA256 293f7c3b7225ea67508c171b8da385089ccb8593cd3406733f21ff19b52e98b0
MD5 c70a1676bab936c07ba5f9d552087a3f
BLAKE2b-256 42bf1c4007f0b5256daeff52233dea7f7335ce269ef7cb49f3d0b7995efba4e3

See more details on using hashes here.

File details

Details for the file earendil_mail-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: earendil_mail-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.8.8 Windows/10

File hashes

Hashes for earendil_mail-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b540976ce9af849a80132136e2a8bb0e39a6fcd61272e2b6f37f838f40a3b53d
MD5 e66ca733dc06e0559417b7471fea7828
BLAKE2b-256 ce772b50621a7a7f69f71d8849ca133fba56f0e24e751762d23a0ae0c3cb887c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page