org-mime can be used to send HTML email using Org-mode HTML export.
This approximates a WYSiWYG HTML mail editor from within Emacs, and can be useful for sending tables, fontified source code, and inline images in email.
If the org-mode
contrib/ directory is in your load path, then
is sufficient to load
org-mime exposes two functions
org-mime-htmlize is an interactive Lisp function in `org-mime.el'. (org-mime-htmlize ARG) Export a portion of an email body composed using `mml-mode' to html using `org-mode'. If called with an active region only export that region, otherwise export the entire body.
org-mime-org-buffer-htmlize is an interactive Lisp function in `org-mime.el'. (org-mime-org-buffer-htmlize) Export the current org-mode buffer to HTML using `org-export-as-html' and package the results into an email handling with appropriate MIME encoding.
The following key bindings are suggested, which bind the
C-c M-o key
sequence to the appropriate
org-mime function in both email and
(add-hook 'message-mode-hook (lambda () (local-set-key "\C-c\M-o" 'org-mime-htmlize)))
(add-hook 'org-mode-hook (lambda () (local-set-key "\C-c\M-o" 'org-mime-org-buffer-htmlize)))
Email clients will often strip all global CSS from email messages. In the case of web-based email readers this is essential in order to protect the CSS of the containing web site. To ensure that your CSS styles are rendered correctly they must be included in the actual body of the elements to which they apply.
The `org-mime-html-hook' allows for the insertion of these important CSS elements into the resulting HTML before mime encoding. The following are some possible uses of this hook.
For other customization options see the
org-mime was developed by Eric Schulte with much-appreciated help
and discussion from everyone on the "using orgmode to send html mail"
thread especially Eric S. Fraga for adding WL support.