Giter Site home page Giter Site logo

emili's Introduction

Emili

Simple interface for sending mails. Turns input formats such as Markdown or console outputs using ANSI colors into nice dual plaintext/html messages. You may specify an html skeleton and a css file which are turn mail compatible.

Module usage

import emili

content = """
# this is a title

Read **this** is very _important_!!

"""

emili.sendmail(
    from  = "[email protected]",
    to = [ "[email protected]", "[email protected]" ],
    bcc = [ "[email protected]" ],
    subject = "About this email"
    md = content,
    attachments = [ 'onefile.pdf' ],
	config = '../config.py',
    )

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

smtp=dict(
    host='smtp.acme.cat',
    port=465,
    user='[email protected]',
    password='mecmec',
)

Command line usage

usage: emili.py [-h] -f SENDER -s SUBJECT -t recipient [--body TEXT]
                [--bodyfile BODYFILE] [-C CONFIG.PY] [-c CC] [-b BCC]
                [-r REPLYTO] [--format FORMAT] [--style CSSFILE]
                [--template TEMPLATE] [--dump OUTPUTFILE.eml]
                [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 CONFIG.PY, --config CONFIG.PY
                        Python Module with smtp configuration defined.
  -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.
  --dump OUTPUTFILE.eml
                        Instead of sending, dump the email into a file

reportrun

usage: reportrun [-h] -s SUBJECT -t RECIPIENT [-f SENDER] [-C CONFIG.PY]
                [FILE [FILE ...]] -- COMMAND [COMMAND_ARG ...]

reportrun wraps the execution of a command and sends an email
whenever the command fails. The mail sending is processed by
emili so that ansi codes and spacing are shown properly.

positional arguments:
  FILE                  File to attach
  COMMAND               Command to run
  COMMAND_ARG           Argument for COMMAND

optional arguments:
  -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)
  -C CONFIG.PY, --config CONFIG.PY
                        Python Module with smtp configuration defined.
  -a, --always
                        Sends even if the command does not fail.
  --
                        Marks the start of the command to execute.

Changelog

1.7 (UNRELEASED)

  • Removed execute_send_mail.py

1.6 (2019-10-09)

  • Fix: reportrun ignored endlines
  • reportrun accepts attatchment
  • reportrun --help option and documented in README

1.5 (2018-10-15)

  • Added reportrun script

1.4 (2017-07-02)

  • Fix: dump does not require configuration

1.3 (2016-11-02)

  • --dump option to dump the resulting email as file instead of sending it
  • Fix: Better processing addresses in the format Me <[email protected]>
  • Fix: Do not take the full path as attachment name
  • activate_wrapper.sh moved to somenergia-utils repo

1.2 (2016-03-28)

  • Option -c/--config to explicit configuration file
  • Added wrapper execute_send_mail.sh
  • Added wrapper activate_wrapper.sh

1.1 (2016-01-12)

  • Available on PyPi

1.0 (2016-01-12)

  • First version

emili's People

Contributors

vokimon avatar cesarlr avatar oriolpiera avatar proig avatar

Stargazers

Konstantin L. Golovko avatar

Watchers

Pablo avatar Pres avatar Oscar Fonts avatar  avatar  avatar David Romaní avatar James Cloos avatar javikalsan avatar Wouter Tebbens avatar Eric Garcia avatar Jose Enrique Ruiz Navarro avatar David Riera avatar Roger avatar Dani Estanyol avatar Daniel Quilez avatar  avatar  avatar Eduard Quintana avatar Roc Teis Segura avatar  avatar Juan Pedro Sánchez avatar  avatar  avatar Diego Quintana avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.