DavMail

I used Mac OSX as primary laptop, and most of the time it creates problem if I need to connect to company service which require M$, and exchange email is the most problem. I found DavMail few months ago and it works great, I used it as a bridge between my Mac to company’s web service exchange server so I can use apple’s Mail to retrieve email. Well, not so great as not full feature can’t be enjoyed (yet), at least I can receive and send email. Just tried calendar function yesterday but it’s not work, maybe will try to do it more in some weekend or if I really need it.

But that’s not all, as an engineer I’ll have to had access anytime anywhere to my email, so I’ll need access from cellphone as well. Tried nokia E7 from office earlier and it was really sucks, the software used to hang and various other problems occurred while I used it. So I just use it as backup phone (well, as an engineer, especially HLR engineer, we always have to use 2 different number from different operators, in case of worst case like HLR down, we can still be contacted thru other’s operator number), while for my primary phone went back to iPhone. I’ve been iDevice fanboy since 2008 when I use iPhone 3G. Unfortunately, I couldn’t find software like DavMail which can be used in iPhone as bridge between apple Mail and Exchange server.

The only way is using DavMail as gateway to exchange server, and installed it as server mode. I just tried it using one of my VPS and it works well, still have problem activating SSL mode since installation failed on certificate part, but at least it is working now. I can receive or send email using company’s exchange. The configuration & installation can be read from here, and setup for iDevice (iPhone, iPad, etc) can be found from here.

The only problem is Java since I have limited memory in my VPS. If I run default davmail, it will show error like this:


$ /usr/bin/davmail davmail.properties
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

This is the common problem of java application run on VPS. Since VPS only have limited space of memory, and since java application is most of the time used in Desktop computer, default configuration will set memory to higher value. For davmail, here’s the content of /usr/bin/davmail,


#!/bin/sh
export LD_LIBRARY_PATH=/usr/lib/jni
for i in /usr/share/davmail/lib/*; do export CLASSPATH=$CLASSPATH:$i; done
java -Xmx512M -cp /usr/share/davmail/davmail.jar:/usr/share/java/swt.jar:$CLASSPATH davmail.DavGateway "$@"

Easy spot eh? we just need to change virtual memory configuration which will be used by java to lower value, above configuration set to 512M, since that’s the memory of my VPS the java apps won’t run. I change the value to 128M to make it work:


...
java -Xmx128M -cp /usr/share/davmail/davmail.jar:/usr/share/java/swt.jar:$CLASSPATH davmail.DavGateway "$@"

and now it works,


$ davmail davmail.properties
2011-11-28 03:36:24,568 ERROR [main] davmail - Unable to set log file path
2011-11-28 03:36:24,571 ERROR [main] davmail - Unable to set log file path
2011-11-28 03:36:24,687 INFO [main] davmail - DavMail Gateway 3.9.6-1843 listening on SMTP port 1337 POP port 1338 IMAP port 1339 CALDAV port 1340 LDAP port 1398
2011-11-28 03:36:24,964 DEBUG [CheckRelease] davmail.DavGateway - DavMail released version: 3.9.6-1843
2011-11-28 03:41:21,500 DEBUG [davmail.imap.ImapServer] davmail - Connection from /78.x.x.x on port 10141
...

Send and receive office’s email anytime anywhere now wouldn’t be a problem.

Oh, and fellow hackers out there, please stay away from my VPS :p.

Advertisements

One thought on “DavMail

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s