Skip to main content

Mail sending Python/CLI interface using markdown or ANSI codes based content

Project description

Simple interface for sending mails. Turns input formats such as Markdown or console outputs using ANSI colors into nice dual plaintext/html messages.

Module usage

import emili

content = """
# this is a title

Read **this** is very _important_!!

"""

emili.sendmail(
    from  = "me@acme.cat",
    to = [ "abe@acme.cat", "bill@acme.cat" ],
    bcc = [ "me@acme.cat" ],
    subject = []
    md = content,
    attachments = [ 'onefile.pdf' ],
    )

Right now a config.py file is required containing the configuration options for the SMTP connection in a dictionary named smtp:

smtp={
    host='smtp.acme.cat',
    port='',
    user='roadrunner@acme.cat',
    password='mecmec',
}

Command line usage

usage: emili.py [-h] -f SENDER -s SUBJECT -t recipient [--body TEXT]
                [--bodyfile BODYFILE] [-c CC] [-b BCC] [-r REPLYTO]
                [--format FORMAT] [--style CSSFILE] [--template TEMPLATE]
                [FILE [FILE ...]]

Sends an email.

positional arguments:
  FILE                  File to attach

optional arguments:
  -h, --help            show this help message and exit
  -f SENDER, --from SENDER
                        Message sender ('From:' header)
  -s SUBJECT, --subject SUBJECT
                        Message subject ('Subject:' header)
  -t recipient, --to recipient
                        Message recipient ('To:' header) (multiple)
  --body TEXT           Message body (defaults to stdin)
  --bodyfile BODYFILE   File containing the message body (defaults to stdin)
  -c CC, --cc CC        Message copy recipient ('CC:' header) (multiple)
  -b BCC, --bcc BCC     Message hidden copy recipient ('BCC:' header)
                        (multiple), other recipients won't see this header
  -r REPLYTO, --replyto REPLYTO
                        Default address to reply at ('Reply-To:' header)
                        (multiple)
  --format FORMAT       Format for the body. 'md' takes markdown and generates
                        both html and text. 'ansi' does the same, turning ANSI
                        color codes in html or stripping them for text.
  --style CSSFILE       Style sheet for the html output, (multiple)
  --template TEMPLATE   Alternative template for the html body.

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

emili-1.1.tar.gz (4.3 kB view details)

Uploaded Source

File details

Details for the file emili-1.1.tar.gz.

File metadata

  • Download URL: emili-1.1.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for emili-1.1.tar.gz
Algorithm Hash digest
SHA256 7f99106fff336fc1c34b8ed03d1e8855916932c96f6ff14214f71e7311802f94
MD5 96504c4bc3cd3e084998026c75665677
BLAKE2b-256 39d88eaee237c94b216d3fcb8bd62dcf40120cdee84ef97eb6bc47fbb9de3aac

See more details on using hashes here.

Supported by

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