[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: reading and writing html mail



Matt Price wrote:

>- occasionally I want to send an html mail, usually in response to one
>  I've received.  I would really like to be able to use e.g. org-mode
>  style links in the text, e.g. [[click
>  here][http://some.url.here/right]] and have them render as html
>  after processing.  does anyone do this?  maybe using some kind of
>  hook to switch composition modes depending on whether the mail
>  you're repsonding to is html or plaintext?

Using the code attached does the trick of converting the message body
into html before sending.  It requires Org mode to be installed
because the conversion is done by Org mode's html export function.

Org is shipped with Emacs since 22.1 (iirc); you might also profit of
the minor modes orgstruc-mode, orgstruc++-mode and orgtbl-mode for
editing messages even if you don't want to send html messages: these
minor modes give the power of Org's outlining features (headlines,
bullet lists) and the table editor.  For information on these minor
modes see [1] and [2].

Back to sending html messages: Loading the file attached adds
following four functions:

   - dmj/wl-send-html-message

     Function that does the job: Convert everything between "--text
     follows this line--" and first mime entity (read: attachment) or
     end of buffer into html markup using `org-export-region-as-html'
     and replaces original body with a mime entity of text/html,
     content-disposition: inline.  Line breaks of the signature are
     preserved.

     Cannot be called interactively: It is hooked into SEMI's
     `mime-edit-translate-hook' if message should be html message.

   - dmj/wl-send-html-message-draft-init

     Cannot be called interactively: It is hooked into WL's
     `wl-mail-setup-hook' and `wl-draft-reedit-hook' and provides a
     buffer local variable to toggle.

   - dmj/wl-send-html-message-draft-maybe

     Cannot be called interactively: It is hooked into WL's
     `wl-draft-send-hook' and hooks `dmj/wl-send-html-message' into
     `mime-edit-translate-hook' depending on whether html message is
     toggled on or off

   - dmj/wl-send-html-message-toggle

     Toggles sending of html message.  If toggled on, the letters
     "HTML" appear in the mode line.

     Call it interactively!  Or bind it to a key in `wl-draft-mode'.

Everything besides a keybinding of `dmj/wl-send-html-message-toggle'
is done upon loading attached file.  If you have to send html messages
regularily you can set a global variable
`dmj/wl-send-html-message-toggled-p' to the string "HTML".

The image at [3] shows an example of how the html message looks like
in Google's web frontend.  As you can see you have the whole markup of
Org at your service: *bold*, /italics/, tables, lists...

So even if you feel uncomfortable with sending html messages at least
you send html that looks quite good.

Alas, there are remaining questions: How to quote in html messages.
Or even detect if someone who sends out html messages quoted an
original message.

HTH
 -- David

[1] http://orgmode.org/manual/Orgstruct-mode.html#Orgstruct-mode

[2] http://orgmode.org/manual/Orgtbl-mode.html#Orgtbl-mode

[3] http://s11.directupload.net/file/u/15851/48ru5wl3.png
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

Attachment: wl-send-html-message.el
Description: Binary data