Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython

genemail is unavailable in PyPM, because there aren't any builds for it in the package repositories. Click the linked icons to find out why.

 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
Windows (64-bit)
Mac OS X (10.5+)
Linux (32-bit)
Linux (64-bit)
0.1.5 Failed View build log
 
Links
License
MIT (http://opensource.org/licenses/MIT)
Lastest release
version 0.1.5 on Jan 9th, 2014

Warning

2013/07/29: genemail is in its very early stages - you should come back later.

genemail makes creating and sending templated email easier. The following features are built-in:

  • Automatic html-to-text conversion so that all generated emails have both a plain-text and an HTML version. Note that if the auto- conversion is not sufficient, each version can have it's own template.
  • Automatic inlining of CSS for maximum backward compatibility with old and/or problematic email clients.
  • Automatic attachment management allows a common email template to specify default attachments; additional attachments can be added to individual emails.
  • Support for DKIM email header generation so that emails that are indeed not spam are less likely to be identified as such.
  • Preview data allows templates to define sample data so that email previews can be generated with predefined data and/or dynamic data.
  • Unit of test for generated emails is made easier thanks to a sender mechanism that allows outbound emails to be trapped for analysis instead of being delivered.

TL;DR

Install:

System Message: ERROR/3 (<string>, line 42)

Unknown directive type "code-block".

.. code-block:: bash

  $ pip install genemail

Given the following package file structure:

-- mypackage/
   `-- templates/
       `-- email/
           |-- logo.png
           |-- invite.html
           |-- invite.spec         # if missing: defaults are used
           |     Example content:
           |       attachments:
           |         - name:  logo.png
           |           value: !include-raw logo.png
           |           cid:   true
           `-- invite.text         # if missing: auto-generated from .html

Use genemail as follows:

System Message: ERROR/3 (<string>, line 65)

Unknown directive type "code-block".

.. code-block:: python

  import genemail, templatealchemy as ta

  # configure a genemail manager that uses the local SMTP server
  # and uses mako templates from a python package named 'mypackage'
  manager = genemail.Manager(
    sender   = genemail.SmtpSender(host='localhost', port='25'),
    provider = ta.Manager(
      source   = 'pkg:mypackage:templates/email',
      renderer = 'mako'),
    modifier = genemail.DkimModifier(
      selector = 'selector._domainkey.example.com',
      key      = '/path/to/private-rsa.key',
      )
    )

  # get an email template object
  eml = manager.newEmail('invite')

  # set some parameters that will be used by mako to render the
  # template
  eml['givenname'] = 'Joe'
  eml['surname']   = 'Schmoe'

  # add an ICS calendar invite
  eml.addAttachment(
    name        = 'invite.ics',
    value       = create_invite(...),
    contentType = 'text/calendar; name=invite.ics; method=PUBLISH')

  # and send the email
  eml.send()

  # the resulting email will:
  #   - have two alternative formats (text/plain and text/html)
  #   - have one top-level attachment (text/calendar)
  #   - have one text/html related attachment (logo.png)
  #   - be DKIM-signed

Overview

TODO: add docs

Subscribe to package updates

Last updated Jan 9th, 2014

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.