Free pushmail with IMAP IDLE howto

Did you now that is possible to get totally free pushmail on your symbian phone? All you pay for is data traffic if you use via GPRS/UMTS. And if you have a good data traffic plan it would be totally free.

The solution works really great via WLAN, and on most GPRS/UMTS networks. Some operators however automatically close idle connections, but often this can be avoided by forcing the access point (AP) to give you a public IP-address. The only thing you need to get this working is have access to an IMAP server that supports the IDLE command, or to be able to configure your own server. This howto has three parts: Installing your own server, setting up a phone to use IMAP IDLE and getting your AP to provide a public IP-address.

Article continues after ad

Here I will show you how to install your own IMAP server, configure it, and get it running. I have chosen the cyrus IMAP server seeing as it's a quite good open source IMAP server that supports IMAP IDLE commands. I will be installing it on a debian system, configuring it to authenticate via /etc/shadow (local users) and finally configuring exim to copy incoming mail to the cyrus IMAP server.

Setting up your server

Install the cyrus IMAP server, the cyrus administration tool and sasl authentication mechanism:

apt-get install cyrus21-imapd cyrus21-admin sasl2-bin

Next we want to set up cyrus to use root as the admin account, and to tell it to verify users from /etc/shadow. Open and edit the file

emacs /etc/imapd.confg

Find admins: cyrus and replace it with admins: cyrus root. In the same file find sasl_pwcheck_method: auxprop and replace it with sasl_pwcheck_method: saslauthd.

Open and edit the following file:

emacs /etc/default/saslauthd

Replace # START=yes with START=yes. This will tell saslauthd to start automatically when the server is booted. In the same file find MECHANISMS="pam" and replace it with MECHANISMS="shadow".

Back in the terminal we must create users for everyone that is going to log on to the IMAP server:

cyradm --user root localhost  
localhost> cm user.newuser  
localhost> lm  user.newuser (HasNoChildren))  
localhost> quit

Replace newuser with the username you are going to add. Repeat this process for every user that is going to use the IMAP server.

Finally we must set up exim to send a copy of incoming mail to the cyrus IMAP server. To do this we must write an exim router plug-in and an exim transport plug-in. Here are the plug-ins I wrote

Router:

router/889_exim4-config_local_user_cyrus

#################################
local_user_cyrus:
ebug_print = "R: local_user_cyrus for $local_part@$domain"
driver = accept
domains = +local_domains
unseen
check_local_user
transport = local_delivery_cyrus

Transport:

transport/30_exim4-config_local_delivery_cyrus

local_delivery_cyrus:
driver = pipe
command = /usr/sbin/cyrdeliver -m ${substr_1:$local_part_suffix} -- $local_part
user = cyrus
group = mail
return_output
log_output
message_prefix =
message_suffix =

Article continues after ad
# Setting up on your phone The next step is to configure your phone to use the IMAP server you just created. I use my system together with gmail. I have configured gmail to forward a copy of all incoming mail to my own mail server. This allows me to get new mail pushed directly onto my phone, and even though I delete mail on my phone (and the server) they will still reside in gmail. I use gmail directly instead of my own server to send mail from the phone. This is a good idea because sent email will reside in the gmail outbox both when sending from the phone and from gmail. If you prefer sending email from your own server just change the settings below accordingly:

Enter Menu->Messag.->Options->Settings->E-mail->Mailboxes->Options->new mailbox. Use the following settings for the mailbox:

Connection settings->Incoming e-mail:
User name: your user name
Password: your password
Incoming mail serv.: the address of the server you just created
Mailbox type: IMAP4
Connection settings->Outgoing e-mail:
My e-mail address: Your e-mail address
User name: Your username. (for gmail this is the same as e-mail address)
Password: your password
Outgoing mail serv.: smtp.gmail.com
Security (ports): StartTLS
Port: 587
User settings
Send message: Immediately
New e-mail alerts: On

Test your new mailbox by selecting Options->Connect. Try it with WLAN first. If you leave the mailbox open new e-mail will be delivered immediately to your phone. And you will be alerted of new e-mail:

Setting it up with GPRS/UMTS

Normally this will work with GPRS/UMTS automatically. Some operators kill idle connections automatically. This will of course kill your pushmail connection too. Very often there is a workaround. Many operators offer public IP-addresses so you can use VPN. If you can get a public IP-address the connection will not be killed (seeing as this could kill the VPN too). They very often don't inform the general public about this option so you might have to search a bit or contact your operator to get the information on how to set your access point (AP) to use a public IP-address. Here is how to do it with the Norwegian network operators Telenor and Netcom. (Should also work with their sub providers)

With Netcom:

Change your regular access point:
Menu->Tools->Settings->Connection->Access Points
Select your regular GPRS access point and change the Access point name
(not the Connection name) from internet.netcom.no to vpn.netcom.no

With Telenor:

Change your regular access point:
Menu->Tools->Settings->Connection->Access Points
Select your regular GPRS access point and change the Access point name (not the Connection name)
from internet to internet.public

Photo by Luke Porter / Unsplash