OrgMsg is a GNU Emacs global minor mode mixing up Org mode and your Mail User Agent Mode (Message mode or mu4e mode) to compose and reply to emails in a Outlook HTML friendly style.
Not that I really like the Outlook email style but in a work environment dominated by this software, it is good to be able to reply with the same style. By default, if the original message is in text form OrgMsg keeps it that way and does not activate itself. It allows to reply to developer mailing list (or any real technical people who knows how to handle text email) seamlessly. If the original message is in the HTML form, it activates the OrgMsg mode on the reply buffer.
OrgMsg provides a org-msg-edit-mode
which is an derivation of Org mode in which some functionality of the current Mail User Agent (Message mode or mu4e mode) are imported or replicated. For instance, a OrgMsg buffer uses the same font-lock-keywords
than Message mode or the TAB
key while the cursor is in the header calls the message-tab
function.
For convenience, the original message is quoted below the --citation follows this line (read-only)--
marker. So you can easily refer to the original message. However, the entire quoted text is read-only because OrgMsg does not support modification of the original content.
OrgMsg has a mechanism to support different Mail User Agents (message, mu4e, …). Each function which depends on the Mail User Agent calls org-msg-mua-call
function which is an indirection to the OrgMsg Mail User Agent specific function.
Outlook email are really poor compared to what can be achieved by Org mode. I personally use the #+{begin|end}_quote
to quote part of the email I am replying to. I extensively make use of #+{begin|end}_src mode
to provide extract of code or example of changes, I sometimes use Org babel to generate an on the fly sequence diagram (using plantuml) or a simple graph (using dot).
The OrgMsg mode keys are the usual key combination used in either Org mode or Message mode.
C-c C-e
– callsorg-msg-preview
, it generates the final HTML email, save it into a temporary file and call thebrowse-url
function on that file.C-c C-k
– callsmessage-kill-buffer
C-c C-s
– callsmessage-goto-subject
(same as in Message mode)C-c C-b
– callsorg-msg-goto-body
(similar tomessage-goto-body
in Message mode)C-c C-a
– callsorg-msg-attach
, very similar to theorg-attach
function. It lets you add or delete attachment for this email. Attachment list is stored in the:attachment:
property.C-c C-c
– callsorg-ctrl-c-ctrl-c
. OrgMsg configuresorg-msg-ctrl-c-ctrl-c
as a final hook of Org mode. Whenorg-msg-ctrl-c-ctrl-c
is called in a OrgMsg buffer it generates the MIME message and send it.
The org-msg-mode
interactive function can be called to enable/disable OrgMsg. By default, once the module is loaded, it is disable. If you want to reply to an email without making use of OrgMsg, you should call that function before you call the reply-to function.
To start composing a new OrgMsg email, you can call the interactive message-mail
function. If your mail-user-agent
is message-user-agent
(which is the by default Emacs configuration), compose-mail
calls message-mail
and is bound to [C-x m]
by default.
OrgMsg depends on this module: emacs-htmlize
The default Emacs Mail User Agent is Message, if you are a mu4e user, you need to define your mail user agent (see mu4e documentation - Emacs-default) because OrgMsg places some hooks and runs specific functions depending on the current Mail User Agent. The proper Mail User Agent should be defined before you activate OrgMsg (call the org-msg-mode
function). Here is how you can define the Mail User Agent mu4e.
(setq mail-user-agent 'mu4e-user-agent)
The following is my configuration which you can use as an example.
(require 'org-msg)
(setq org-msg-options "html-postamble:nil H:5 num:nil ^:{} toc:nil author:nil email:nil \\n:t"
org-msg-startup "hidestars indent inlineimages"
org-msg-greeting-fmt "\nHi *%s*,\n\n"
org-msg-greeting-name-limit 3
org-msg-text-plain-alternative t
org-msg-signature "
Regards,
#+begin_signature
-- *Jeremy* \\\\
/One Emacs to rule them all/
#+end_signature")
(org-msg-mode)
The org-msg-greeting-fmt
can be customized to configure the default greeting message. If this format contains a %s
token it is automatically replaced with the first name of the person you are replying to. If org-msg-greeting-fmt-mailto
is t, the first name it is formatted as mailto link.
If org-msg-text-plain-alternative
is t
, OrgMsg generates an ASCII export of the message and attach this export as a text/plain
alternative to the HTML email.
In order to avoid CSS conflict, OrgMsg performs inline replacement when it generates the final HTML message. See the org-msg-enforce-css
variable to customize the style (and the default org-msg-default-style
variable for reference).
Setting the org export option tex:dvipng
or tex:dvisvgm
is handeled correctly by this mode by producing inline images or inlining the generated SVG. Note that most mailclients however sadly do not display SVG content in mails so it might be best to stick to settings producing images unless you know your recipient’s mailclient supports SVG.