Download Latest Version plainMail2HTML-0.1.tar.bz2 (41.0 kB)
Email in envelope

Get an email when there's a new version of plainMail2HTML - text/plain to html mail

Home
Name Modified Size InfoDownloads / Week
plain2html 2010-12-04
README.rst 2010-12-04 3.3 kB
Totals: 2 Items   3.3 kB 0

README: plainMail2HTML

Author:Amit Ramon
Contact:amitrm@users.sourceforge.net
Date:Sat, 4 Dec 2010
Web site:http://plain2html.sourceforge.net/
Copyright:This document has been placed in the public domain.

About

plainMail2HTML is a tool that creates and attaches a HTML part to an email message that has just a text/plain part. It support working with markup tools (in example, reStructuredText) so that the plain text may contain markup formatting marks that would affect the generation of the HTML part.

Purpose

The purpose of using this tool is to enable sending email messages in HTML format using email clients (MUA) that are textual (for instance, Mutt). When working with Mutt, all one has to do is to replace the normal definition of Mutt's sendmail configuration variable with a definition that calls plain2html-mail.py. That way, when a mail is sent from Mutt, it will be modified on the fly by appending to it a HTML part, then it will be handed over to the normal sendmail command.

There might be a couple of reasons why one would like to do such a thing. First, one may want to send a fancy message. The second possible reason is what initiated the development of this tool. Many people are reading their mail using web-mail clients. Many of these clients fail, on some occasions, to display text/plain messages correctly when the message is in a language that is written from right to left, such as Arabic or Hebrew. For example, the alignment of text in Gmail web-mail client depends on the language of the user interface. If, for example, the UI language is English, and I have a text/plain message written in Hebrew, the text would be left-aligned, making it very inconvenient to read.

How does it work

The email can actually be a multipart/mixed message, and then it is assumed to have a text/plain as the very first component. The tool will then replace this component with a multipart/alternative component containing the original text/plain part and a new text/html part.

It is assumed that msg is generated by Mutt, with a known structure. It is multipart/mixed, and the first component is a text/plain message, encoded in utf-8 8-bit. The first component is replaced by a multipart/alternative message that contains the original first component (text) and a HTML version of it.

Quick-Start

This is for those who want to get up & running quickly. Read on for complete details.

  1. Unpack the tarball in its own directory. Make sure that the directory plain2html (the one containing this README file) is in your PYTHONPATH environment variable.

  2. For Mutt: edit your muttrc file. Usually it contain the following, or a similar, definition:

    set sendmail="/usr/lib/sendmail -oem -oi $@"

    Change this line to read:

    set sendmail="/path/to/this/tool/bin/plain2html-mail.py -- $@"

  3. Look at the tool settings.py file. You may need to edit the location of the HTML template (the template is in the templates directory of the installation). You might also have to edit the sendmail setting -- it should be the same definition that originally was in the muttrc file.

Source: README.rst, updated 2010-12-04