Our organization is switching to using Microsoft Exchange Server 2016. I previously automated sending emails directly from a Linux machine, using mail, which works fine for in-house clients behind the same firewall. However, we're increasing getting outside clients that I have to manually send emails to. I want to be able to set up an email client on my Linux machine that I can script to send emails via my Microsoft Exchange account so that my emails are no longer blocked as SPAM.

I've been told that to work, "[e]mail clients must be able to support the robust MAPI/HTTP environment."

Thunderbird supports IMAP and POP.

What Linux clients support MAPI/HTTP?

Previously, I've just been using a script to generate an email and send it it using mail:

cat email_message.txt | mail -s 'Data ready for download' -c [email protected] [email protected]

I did find mention of using Evolution for interacting with Microsoft Exchange, but it was from 2010 and seemed to be a GUI-based client instead of a command-line client.

I'm using a 64-bit Centos 7 machine, by the way.

Cross-posted at StackOverflow

  • You might wish to take a look at OpenMapi and projects using that. There's e.g. php-mapi or the package php-horde-mapi, if you're open to that path. I've no experiences with that, so I cannot give further hints – just vaguely remembered those ;)
    – Izzy
    Commented Dec 10, 2016 at 12:31

1 Answer 1


I'm surprised your sysadmins have referred you to MAPI as this old protocol (and OWA) has been replaced by EWS as the preferred protocol for microsoft servers. Both of these protocols are hard to use from Linux, but the latter is better documented and there are some clients, eg in python PyEwsClient.

But if you only need to send mail, you might instead check whether you can simply use authorised SMTP, which is often the case. The msmtp program is simple to configure to send mail with your login so that it is not marked as spam. Example ~/.msmtprc file:

tls_certcheck off
tls on
account default
host mailserver.local
#port 25
from [email protected]
auth on
user windozedomain/myid
password mypw

You might need to specify another port, eg 587 or 465.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.