Making the Blackberry work with your IMAP email

by Laurent Itti, April 26, 2005

Blackberry users currently have two options for their email connectivity: the Blackberry Enterprise Server (BES), a software that needs to be installed on your company's server and enables full functionality of your Blackberry, or the Blackberry Web Client (BWC), a web-based interface that allows only restricted Blackberry functionality.

Current status with BWC

As many people do not have BES installed at their company, they rely instead on BWC. BWC, however, makes it difficult to keep your email synchronized between your main mail server and your Blackberry. In particular:

  • When you read/reply to/delete/file emails on your blackberry, these actions will not be reflected on your main server.
  • When you register your main email server (POP3 or IMAP) with BWC, all this achieves is that the BWC server will contact your server every 15 minutes, pull any new unread emails, and forward a copy of those to your Blackberry. So your Blackberry is always only dealing with copies, never with the real thing stored on your IMAP server. Anything you do on either your Blackberry or the BWC web page (e.g., nuke all emails) will have no effect onto your main server.
  • When you compose new emails from your Blackberry, you will not get a copy of those directly in the sent-mail folder on your server. BWC provides the option of specifying a default bcc: address to which every email sent from the blackberry will be carbon-copied, but unless you want those emails to later come back to your Blackberry in some infinite loop you would not want to use your main email address for that.

Thus, at present, BWC provides a rather poor level of integration between your Blackberry and your main email server. Most people seem to use their Blackberry just to rapidly scan incoming email and reply to a few urgent ones, knowing that next time they get to their desktop things will appear as if nothing had been done on the Blackberry.

A solution for more interactivity?

The solution proposed here achieves the following functionality:

Theory of operation

The main idea is pretty simple: Every email received by your main server will be carbon-copied to your blackberry for immediate consumption. To file from your Blackberry an email into an IMAP folder on your main server, you will forward that email back to your main email address, typing into the body of the forwarded message the name of the folder you want the email to be filed into. This can be achieved in very few wheel clicks and keystrokes on your Blackberry. In order to be able to mark an email as answered on your main server when you answer it from your Blackberry, and also to store on your main server the reply you have sent, you will bcc: your main email address on every email you send from the Blackberry. Given that bcc:, every email you send from your Blackberry (not only replies, but new composed messages as well) will also be stored as sent-mail on your main server.

For more details on operation, see below.

The main difficulty is to avoid infernal mail loops, whereby emails keep getting forwarded from your Blackberry to your main server, which then forwards a copy back to your Blackberry, and so on indefinitely.

The proposed setup which solves this difficulty relies on three components:

Caveats and limitations:

The code

Assume the following setup:

Based on this, our scheme works as follows:

The key is that you should normally never have to forward emails from your Blackberry to your main email address, as this kind of forwarding will now be reserved for IMAP filing actions. You can of course forward to anybody else you like, just not you@yourcompany.com. To ensure this, you need to make sure people never send email to your Blackberry email address (yourbb@prov.blackberry.net) directly; instead they should send all email to you@yourcompany.com. In these conditions, you will have a copy on your main server of every email you ever get on your Blackberry, obviating the need to ever forward an email from the Blackberry to the main server.

How to set it up

We again assume that your IMAP server is of Unix-type. Login onto your account, and setup the following.

View File .forward      (click icon to expand)

View File .procmailrc      (click icon to expand)

View File bbfiler.pl      (click icon to expand)

Remember that this is alpha code and setting it up may be tricky depending on how familiar you are with the tools used here. I recommend trying these out with a non-critical email account before attemting to use it in daily operation.

Operation

I get the following functionality:

Conclusion and links

It works well for me thus far. I am not losing email and I am able to file emails while I am on the go, so that I have a nice and clean inbox when I get back to my desktop.

This was developed over the first weekend after I got my Blackberry. It is unlikely that I will have more time to devote to it given that it works in most cases for me. But by all means feel free to tweak, improve, enhance and contribute your improvements.

Useful links:


[Home] - [Research] - [Publications] - [People] - [Facilities] - [Classes] - [Opportunities] - [Events]


Copyright © 2005 by the University of Southern California, iLab and Prof. Laurent Itti