SDB:Access Exchange Server using fetchExc and Kmail

Jump to: navigation, search


This article explains how to utilize the Outlook Web Access (OWA) facility of a Microsoft Exchange Server to download emails to a standalone client like Kmail/Thunderbird using a program called fetchExc.

Background

Many companies and academic institutes provide email facilities using Microsoft Exchange server, which can be accessed using Microsoft Outlook under Windows. For Linux users, the only email client which supports Exchange server is Novell Evolution, using the evolution-exchange connector. Fortunately, emails can be accessed using a web-interface if Outlook Web Access is enabled. But, this situation is not convenient for users of standalone email clients like Kmail or Thunderbird.

fetchExc

fetchExc is a java-based program by Juhani Rautiainen, which can retrieve email from an Exchange 2000/2003 server and forward it to an SMTP server or to a local file (mbox). This mbox file can then be read using Kmail or Thunderbird or any other email client which supports mbox format. fetchExc also supports the https protocol for secure access and is released under the GNU General Public License.

Requirements

fetchExc - http://personal.inet.fi/atk/fetchexc/fetchExc-2.0.tar.gz
Java runtime environment

Installation

Assuming the archive is downloaded to the home directory

  • Uncompress the archive
tar -zxvf fetchExc-2.0.tar.gz

This will create a new directory called 'fetchExc-2.0' containing a number of jar files in the home directory

  • Adapt the fetchExc.properties.example to your requirements. To do this copy this to a new file fetchExc.properties. One way to do this will be
cd fetchExc-2.0
cp fetchExc.properties.example fetchExc.properties

The example file looks like this

ExchangeServer=xxx.dddddd.com
ExchangePath=exchange
MailServer=yyy.dddddd.com
DestinationAddress=user@yyy.dddddd.com
Username=domainuser
Password=domainpassword
Domain=DOMAIN
Delete=false
All=false
Secure=true
FBApath=/exchweb/bin/auth/owaauth.dll
ForceFrom=false
ForceFromAddr=fake.sender@yyy.dddddd.com
NoEightBitMime=false

The homepage has explanations on these parameters. For now, the most important ones are

ExchangeServer
This is the URL which you use to access email using a browser without the /exchange Example: If the URL is http://mycompany.com/exchange, the value for ExchangeServer will be http://mycompany.com

ExchangePath
Leave it as default, unless it differs

Domain
The domain you belong to.

Username
Your username for the domain

Password
Enter your password here.

MboxFile
MboxFile=/home/username/fetchExc-2.0/mymail.mbox

Secure
This must be true if the URL which you use to access contains https:// instead of http

You can probably set this to the default mail location i.e., /var/spool/mail/yourlogin. Either way it should work. This option is required only if you want to download all emails to the Email client. Leave all other options as default. The options MailServer and DestinationAddress will be useful if you want to forward your emails to an SMTP server rather than downloading locally.

The configuration which worked for me

ExchangeServer=virtualexchange.com
ExchangePath=exchange
Username=vimal
Password=topSecret
Domain=ADMIN
MboxFile=/home/vimal/fetchExc-2.0/mymail.mbox
Delete=false
All=false
Secure=true
FBApath=/exchweb/bin/auth/owaauth.dll
NoEightBitMime=false


Icon-warning.png
Warning: Since the fetchExc.properties file contains the password, it is essential to change the permissions such that only the user has read access.


cd fetchExc-2.0
chmod 600 fetchExc.properties
  • Test the configuration
cd fetchExc-2.0
java -jar fetchExc.jar -p fetchExc.properties

If successful, it produces a message like

Starting fetchExc v2.0 Tue, 13 Nov 2007 13:40:23
1 message for vimal at virtualexchange.com
Message 1 sent OK
  • Access mails using Kmail/Thunderbird

A shell script fetchExc.sh can be created and saved in the ~/bin directory like this

#!/bin/bash
java -jar ~/fetchExc-2.0/fetchExc.jar -p ~/fetchExc-2.0/fetchExc.properties >> ~/fetchExc-2.0/fetchExc.log 2>> ~/fetchExc-2.0/fetchExc.err

Make the script executable with

chmod +x fetchExc.sh

Open Kmail/Thunderbird and Create an email account. Specify account type as "Local mailbox" and point to the /home/username/fetchExc-2.0/mymail.mbox file for the File Location. In Kmail, the above script can be called for the Pre-command. So everytime when the mail is checked, the pre-command (/home/username/bin/fetchExc.sh) is executed and the mail is stored in the mbox file, which is then retrieved by Kmail. Another possibility would be to use cron to call the script as and when required as suggested by the author.

What is not tested

Sending mails - Not sure whether it will work. Alternatives include sendmail or other SMTP accounts

Alternatives

MrPostman - http://mrpostman.sourceforge.net also has a plugin for OWA

Resources

fetchExc - http://personal.inet.fi/atk/fetchexc/