Fetch mail from Exchange server

Just install Davmail ( It’s a mail agent converting Exchange server into POP3 and IMAP server.

The only issue is that Davmail POP3 server MIGHT be better for Gnus. See for the details. I got the issue only in one company. I cannot reproduce it in other companies. Anyway, you can test IMAP/POP3 in one min at the beginning. So it’s not a big deal.

Sometimes the default EWS url of server is modified. Then you need EWSEdtor ( to find the url and set it up in Davmail

Now enjoy the world of Freedom.

BTW, you can use a mail classifying software Popfile ( to classify mails because Popfile support IMAP and POP3.

Use Emacs as the editor for Outlook

Basically you grab the text of an Outlook email/reply/forwarded message/etc., use Emacs to edit the reply or create a new message, and return the result to the Outlook editing window.

You might be interested in doing the reverse : use Outlook as the “mail server” for Emacs : MessageOutlook

You need some glue to move the message between Emacs and Outlook.

– can I do the same with Mozilla Mail ?

Excorporate: Use Emacs to access Exchange Calendar

You can access your Exchange calendar directly from within Emacs using Excorporate. Learn more.

Excorporate is available in the GNU ELPA repository.

M-x list-packages

Using Excorporate with Office 365

If the automatic configuration fails, and you use Office 365, you may find success with these settings:

(setq excorporate-configuration '("user@domain.tld" . "")))

If this works for you, and you would like to store your credentials in your .authinfo[.gpg] file, the entry needs to be formatted as:

machine login user@domain.tld password secret

As of version 0.9.1 Excorporate requires the port to be attached to the domain, not appended as port 443.

Windows script glue

If your machine has the windows script host installed which should be true for almost all versions currently in use (see then you can use the following script instead of python or tcl. It is merely a port from tcl to Windows script.

Drop a copy of outlookedit.el from or into your load-path, add a (require ‘outlookedit) to your init file.

Save the following code with extension .wsf somewhere on your path and adjust the variables mno-get-outlook-body and mno-put-outlook-body – MartinStemplinger

<?xml version="1.0" encoding="iso-8859-1"?>
  <job id="getMessage">
            This script gets a Message from an open Outlook window
    <script language="JScript">
      try {
        var app = new ActiveXObject("Outlook.Application");
        var inspector = app.ActiveInspector;
      } catch (e) {
        WScript.Echo("Error: " + e)
  <job id="putMessage">
        This script puts the content of StdIn back into an open Outlook
    <script language="JScript">
      try {
        var stdin = WScript.StdIn;                                 
        var app = new ActiveXObject("Outlook.Application");
        var inspector = app.ActiveInspector;
        var body = stdin.ReadAll();

       inspector.CurrentItem.Body= body;       
      } catch (e) {
       WScript.Echo("Error: " + e)

In outlookedit.el (assuming you put the wsf script in ~/bin) --TimAnderson

 (defvar mno-get-outlook-body
   "cscript //B //Job:getMessage ~/bin/outlook_emacs.wsf")
 (defvar mno-put-outlook-body
   "cscript //B //Job:putMessage ~/bin/outlook_emacs.wsf")

Now, in order to edit the currently opened mail in emacs, say ‘mno-edit-outlook-message’ (bound to C-c o e). This opens an *Outlook Message* buffer with your mail. When you are done, say ‘mno-save-outlook-message’ (bound to C-c o s). Attention, the text is sent back to the “current” mail —if you switch back and forth between messages, you risk overwriting the bad message.

The message has to be opened for Reply for the above to work (M-r in Outlook ;-)). I added the snippet after the line beginning var inspector… to remind myself:

  // As above
  var inspector = app.ActiveInspector;

  // Reminder
  if (inspector == null) {
    WScript.StdOut.Write("You haven't opened the message up for Reply...");

Toolbar button

You can also add a macro to Outlook and place that macro on a customized button in the toolbar:

Sub mnoEditInEmacs()
  Shell ("<PATH_TO_EMACS>\bin\gnudoit.exe (mno-edit-outlook-message)")
End Sub

If you have a recent emacs and EmacsClient is setup, you may prefer to call emacsclientw.exe --eval (mno-edit-outlook-message).

When you are replying to a mail, just press this button.

How to create a macro : in Outlook 2010, do a right-click on the Ribbon and select Customize Ribbon, then enable the Developer tab. In the Developer tab, there is a Macro menu that allow you to create a macro. To add the button, in the same Customize Ribbon, in the right column do Create a New Group. In the left column, select Choose Commands from: Macros, and you can add the button to the group you just added.

Forcing plain text mode

Attention, people have reported that some versions of Outlook don’t react too well to scripts changing the format under their nose. It works for me with Outlook 2010. YMMV. Caveat emptor.

In the getMessage part of the WSF script, add the following (mostly stolen from Ernie Longmire):

    var inspector = app.ActiveInspector;
    var mailItem = inspector.CurrentItem;

    /* HTML messages store the full text of the body with HTML
     * markup in a separate string, MailItem.HTMLBody.  In these
     * messages MailItem.Body contains a version of the message
     * with HTML markup removed.

     * When editing an HTML message, .Body is not synchronized with
     * .HTMLBody until .Body is accessed directly in some way.
     * In these cases, changing .BodyFormat to olFormatPlain puts
     * the empty .Body string in the editing buffer, discarding the
     * actual message content.  That's why we explicitly reference
     * .Body below. */
    var junk = mailItem.Body;
    mailItem.BodyFormat = 1;


Python or Tcl glue

The original implementation of the idea was done in Python. Apparently, versions of Windows old enough will not have the necessary scripting infrastructure, and a glue in Tcl or Python is necessary.

I just set this up under XP w/ Office XP and it worked beautifully.EphremChristopherWalborn


I put together a small package based on the Python code mentioned above, but taking advantage of PyMacs for better integration. It provides two commands:

The code can be downloaded from my Emacs page at

(snatched code from

Another python solution is at (but what’s the point of going through some intermediate Tk application?)


Outlook.el package can be used to send HTML or plain-text emails directly from Emacs, and they will look exactly as they were sent from MS Outlook with all fancy HTML formatting that Outlook usually does. It is meant to be used together with other email packages for Emacs, extending their functionality. As for now, only mu4e integration is supported.

The package does not depend on MS Outlook, so it can be used on Linux as well.

CategoryWThirtyTwo WThirtyTwoSendMAPI