Monday, February 17, 2014

How to get Alpine working with Exchange or Outlook email

Linux user? Need to access email on an Exchange server? Fed up of Outlook or Outlook Web Access? Not happy with Thunderbird?
Yes? Then hello reader. I just managed to get Alpine to work with my company's Exchange 2010 server after badgering my IT admin and looking up several websites. Maybe I'll be able to save you some of the trouble.

First, why bother with Alpine? If you have a Gmail or other free email address wouldn't it connect to an Exchange server and isn't that the modern thing to do? Well free email addresses are not your property. You sort of rent them from a company like Google, who hold your data on their servers. You might be fine with that but your company might not want official stuff to be passing through and held in Google's servers.

Alpine is an email client: a software application that's on your computer. You could consider Thunderbird or Evolution but those to me are poorer cousins of Outlook. Alpine is totally different. It's for people who like the command line!
So here we go...

Install alpine  

> sudo apt-get install alpine
Open .pinerc, the configuration file:  

> gedit .pinerc

Spot these lines:

user-domain= This is the domain where your email is hosted.
Example intranet.example.com

smtp-server= The server address (often a port number is needed as well) for sending email.
Example intranet.example.com:587/tls/user=jdoe

For the above two it is absolutely essential that you consult your IT admin. You don't want to be knocking at the wrong port or using the wrong authentication method. Even if the IT admin gives you the magic lines you might not be able to send email. My admin had to set up a new SMTP receive connector. Not sure what that means but try using that jargon with your admin if you're lost for words.

Moving on...

inbox-path= The path to your inbox in your mailbox in your company's server for receiving email. Example {intranet.example.com/user=jdoe/tls}INBOX

default-fcc= The path to your sent items in your mailbox in your company's server. Example {intranet.example.com/user=jdoe/tls}Sent Items

Want to archive messages within a folder on your server mailbox called, say, 'archive'?

default-saved-msg-folder={intranet.example.com/user=jdoe/tls/}Inbox/archive

Scroll down. Find customized-hdrs. I had to add my name and email address here to fix an annoying error that prevented emails from going out:

50 5.7.1 Client does not have permissions to send as this sender

You don't want to see that. So...

customized-hdrs=From: John Doe <jdoe@example.com>

Scroll down. Way down. Find alt-addresses. Enter the email address from which you're going to send email. Example jdoe@example.com

This 'hack' is to tell Alpine that you are you. Without doing this thing in alt-addresses your sent-items will show your name with every message, not the sender's name.

Scroll down. Way down. Find disable-these-authenticators=. Add GSSAPI to it. This seems to be necessary to avoid getting some kerberos warning at the start of an Alpine session.

Now close .pinerc and open up Alpine.

> alpine

Alpine start screen. A sight for sore eyes.


You can do all of what you have just done from Setup -> Config. But editing the source file is quicker I think.

Now what you need to do is add a collection list so that your existing Exchange mailbox (with all mails) maps to Alpine. Otherwise you will be starting with a clean mailbox, which you probably don't want to do.

Setup -> collectionLists

Add a new collection list for your Exchange mailbox. Type A for add.
You'll see a very simple form and you just need to fill it two fields:

Nickname Anything you want

Server Same as the inbox-path field, e.g., intranet.example.com/user=jdoe/tls
Exit the setup (look at the bottom for keyboard shortcuts), exit Alpine, and restart it.

Go to Folder List. You'll see your Exchange folder there under the nickname you used. Open it. See all the folders there? They've got past mail? Can you send email? Yes? Congratulations! No? I guess you have to go about this the hard way then -- looking up help pages and forums online. But that should work. It did for me.

Composing a message. Doesn't get more elemental than this.

And of course once you get Alpine working there is loads you can do to configure and tune it to make it work just the way you want it to. As with a lot of free software there's really no limit for customization.

Wondering about your calendar? Hmm. Not sure how to get that working with Alpine. Let me know if you do!