Funambol Mobile Open Source — Save 50%
Sync your email and other data with mobile devices using Funambol 7.1
In this article by Stefano Fornari, we will learn about one of the most exciting capabilities of Fuanambol: Mobile e-mail.
One of the biggest advantages of the Funambol platform is that with the same system, Maria can provide e-mail and PIM sync on many mobile platforms, including:
- Windows Mobile PDA and phones
- Symbian smartphones
- BlackBerry phones
- Java-enabled phones
- Apple iPhone
In this article, Maria will set up Funambol to connect to the company e-mail server, in order to enable her users to receive e-mail on their mobile phones.
The E-mail Connector allows Funambol to connect to any IMAP and POP e-mail server to enable mobile devices to receive corporate or personal e-mail.
The part of the Funambol architecture involved with this functionality is illustrated in the following figure:
The E-mail Connector is a container of many things, the most important ones being:
- The e-mail server extension (represented in the figure by the E-mail Connector block): This is the extension of the Funambol Data Synchronization Service that allows e-mail synchronization through the connection to the e-mail provider.
- The Inbox Listener Service: This is the service that detects new e-mail in the user inbox and notifies the user's devices.
When the Funambol DS Service receives sync requests for e-mail, the request calls the E-mail Connector, which downloads new messages from the e-mail server and makes them available to the DS Service, which in turn delivers them to the device.
When a user receives a new e-mail, the new message is detected by the Inbox Listener Service that notifies the user's device to start a new sync.
When the E-mail Connector is set up and activated, e-mail can be synced with an e-mail provider if it supports one of the two popular e-mail protocols—POP3 or IMAP v4 for incoming e-mail and the SMTP protocol for outgoing e-mail delivery.
Please note that the Funambol server does not store user e-mail locally. For privacy and security reasons, e-mail is stored in the e-mail store of the E-mail Provider. The server constructs a snapshot of each user's inbox in the local database to speed up the process of discovering new e-mails without connecting to the e-mail server. Basically, this e-mail cache contains the ID of the messages and their received date and time.
The Funambol service responsible for populating and updating the user inbox cache is the Inbox Listener Service. This service checks each user inbox on a regular basis (that is, every 15 minutes) and updates the inbox cache, adding new messages and deleting the messages that are removed from the inbox (for example, when a desktop client downloaded them or the user moved the messages to a different folder).
Another important aspect to consider with mobile e-mail is that many devices have limited capabilities and resources. Further, the latency of retrieving a large inbox can be unacceptable for mobile users, who need the device to be always functional when they are away from their computer. For this reason, Funambol limits the maximum number of e-mails that Maria can download on her mobile so that she is never inconvenienced by having too many e-mails in her mobile e-mail inbox. This value can be customized in the server settings (see section E-mail account setup).
In the following sections, Maria will learn how to set up Funambol to work with the corporate e-mail provider and how she can provide Funambol mobile e-mail for her users.
Setting up Funambol mobile e-mail
The Funambol E-mail Connector is part of a default installation of Funambol so Maria does not need to install any additional packages to use it. The following sections describe what Maria needs to do to set up Funambol to connect to her corporate e-mail server.
The only thing that Maria needs to make sure about the corporate E-mail Provider is that it supports POP/IMAP and SMTP access from the network where Funambol is installed.
It is not necessary that the firewall is open to mobile devices. Devices will keep using SyncML as the transport protocol, while the Funambol server connects to the e-mail server when required.
Also, the same e-mail server does not need to provide both POP (or IMAP) and SMTP. Funambol can be configured to use two different servers for incoming and outgoing messages.
Funambol authentication with e-mail
One of Maria's security concerns is the distribution and provisioning of e-mail account information on the mobile phones. She does not like the fact that e-mail account information is sent over a channel that she can only partially control.
This is a common concern of IT administrators. Funambol addresses this issue by not storing e-mail credentials on the device. The device (or any other SyncML client) is provisioned with Funambol credentials. In the previous sections, Maria was able to create new accounts so that users could use the PIM synchronization service, and in doing so, she needed to provide new usernames and passwords. This is still valid for e-mail users.
What Maria needs to do now is to configure the E-mail Connector and add the e-mail account of the users she wants to enable for mobile e-mail. These topics are covered in detail in the following sections.
E-mail account setup
To add a user e-mail account to the synchronization service, Maria can use the Funambol Administration Tool, expanding the Modules | email | FunambolEmailConnector node and double-clicking the connector. This opens the connector administration panel, as shown in the following screenshot:
There are two sections: Public Mail Servers and Accounts.
Maria needs to add new accounts. Let's start with her account first.
Clicking the Add button in the Accounts section opens up a new search window so that she can search which Funambol user to attach to the e-mail account. Typing maria in the Username field and clicking Search, will show you the result as shown in the following screenshot:
Double-clicking the desired account displays a form for maria's account details as shown in the following screenshot:
Each field is explained as follows:
- Login, Password, Confirm password, and E-mail address
As the labels of the fields describe, these are the e-mail account credentials and e-mail address. These are credentials used to access the e-mail service, not the ones to access the Funambol synchronization service.
- Enable Polling
This setting enables or disables the functionality of the Inbox Listener Service to check for updates on this account's inbox. When disabled, the account inbox won't be scanned for new/updated/deleted e-mail. This disables e-mail synchronization completely.
- Enable Push
This setting enables or disables the push functionality. When disabled, the user will not be notified of new e-mails. If Enable Polling checkbox is active, the Inbox Listener Service keeps updating this account's e-mail cache anyway. In this case Maria can still download e-mail by manually starting the synchronization from the client.
- Refresh time(min)
This setting specifies how frequently the Inbox Listener Service checks for updates on this account's inbox. The value is expressed in minutes. The shorter this period, the more often new e-mail is detected and therefore the closer the user experience is to real time. However, the smaller this number, the heavier the load on the Inbox Listener Service and the e-mail provider. When you have only a few users, this is not too relevant, but it is something to consider when planning a major deployment.
|Sync your email and other data with mobile devices using Funambol 7.1|
eBook Price: $23.99
Book Price: $39.99
For the tests of the following section, Maria will set this value to 1 minute.
- Max email number
This is the maximum number of e-mails tracked in the account's cache. Maria can adjust this value based on each device that needs to be supported. For a low-end device, this value should not be greater than 30 or 50. For smartphones and more powerful devices, this value can be a few hundred.
In general, mobile users are not interested in having all of their e-mails on their phone but rather the most recent messages, which usually require immediate attention when they are away. A good rule of thumb to select the correct number is the number of new messages a user receives daily.
- Mail server, Server product, and Description
Certain e-mail servers, in particular public servers such as Yahoo! and Gmail have particular implementations of the POP/IMAP protocols that require special processing. The Mail server settings allow Maria to specify if the account is one of those servers. Supported server types include:
- Custom (any POP/IMAP service)
- Google Mail (Google hosted mail)
- Yahoo! (premium account)
- Hotmail (premium account)
For now, Maria will configure her corporate account. She will select Custom as Mail server and Other as Server product. She can also put the server name in the Description field. If one of the above public servers is selected, many of the following settings will be automatically set to the correct server values and cannot be modified.
This setting specifies which protocol the E-mail Connector shall use to access Maria's corporate account. The two possible choices are POP and IMAP.
- Outgoing server, Port, Auth, and SSL Outgoing
These fields allow Maria to specify which SMTP server to use and if it requires any settings different from the standard behavior (in particular, the SMTP port and whether the e-mail server requires authentication).
Funambol currently supports authentication through the e-mail credentials (e-mail address and password).
If Maria's corporate e-mail server requires SSL/TLS, she needs to select
- SSL Outgoing.
- Soft-Delete on server
Soft-delete is when the user deletes a message on the device, but the message is not physically deleted on the e-mail server. This option is particularly helpful to avoid a message being accidently deleted or an e-mail being accidently removed by a user who is cleaning his/her mobile inbox(screen space is a precious resource on many mobile phones). When this option is checked, messages deleted from the mobile client will not be deleted on the e-mail server so that they are still accessible from a desktop or web-based e-mail client.
- Inbox, Outbox, Sent, Draft, and Trash folder name
When using IMAP, the top-level folder names for Inbox, Outbox, Sent, Draft, and Trash may change based on the server implementation or even the user language. These settings (enabled only when the selected protocol is IMAP) allow Maria to map the folder names on the server to the logical Inbox, Outbox, Sent, Draft, and Trash. She can also click the Folders button, as a result the Funambol Administration Tool tries to detect the names of the folders by retrieving them from the mail server.
Incoming server, Port, and SSL Incoming
With these settings, Maria can set the hostname and port of the corporate e-mail provider. If the mail server requires SSL/TLS access, the setting SSL Incoming must be checked.
Inbox Listener Service
The default installation of Funambol is already set up to start the Inbox Listener Service when launching the following command:
However, in a more scalable environment, it is recommended to install this service on a separate box (potentially more than one, depending on the number of e-mail users that the system must serve). The easiest way to do this is to just install Funambol on the dedicated system and start the Inbox Listener Service only.
This is done by launching the following command:
If the Inbox Listener Service is not running, the user's e-mail cache will not be updated and no new e-mail will be detected.
Maria can check that the service is running, by simply issuing the ps command and checking that the output is similar to the following:
ps -ef |grep java
maria 25320 1 0 13:34 pts/2 00:00:15 /
encoding=UTF-8 -Dfunambol.home=/opt/Funambol -
-Xmx256M -Dcom.sun.management.jmxremote -Dcom.sun.
Inbox Listener Service Configuration
Once the Inbox Listener Service detects a new e-mail, it tells the Data Synchronization Service to notify the device to start a new synchronization. This is done with an HTTP remote procedure call, therefore, if the Inbox Listener and Data Synchronization services are on different hosts, the Inbox Listener must be configured with the host name of the Data Synchronization Service.
Maria can do it editing the configuration file $FUNAMBOL_HOME/com/funambol/email/inboxlistener/InboxListenerConfiguration.xml and setting the appropriate values in the serverInformation section like in the example below:
Note that after this change the service must be restarted.
Inbox Listener troubleshooting
To troubleshoot Inbox Listener issues, Maria can access a lot of information parsing the log file.
For technical and historical reasons, at the time of this writing, the Inbox Listener Service's log facility cannot be configured from the Funambol Administration Tool. In order to do so, Maria needs to edit the file $FUNAMBOL_HOME/config/log4j-inboxlistener.xml. For example, to enable full logging, she needs to turn the level of the funambol logger to ALL.
The Inbox Listener log file is located, by default, under $FUNAMBOL_HOME/logs/inbox-listener.
In the next part of the article we will learn about the working and authentication of mobile e-mail.
If you have read this article you may be interested to view :
|Sync your email and other data with mobile devices using Funambol 7.1|
eBook Price: $23.99
Book Price: $39.99
About the Author :
Stefano Fornari is a co-founder and CTO of Funambol, Inc., the leading provider of open source mobile cloud sync and push email solutions for billions of phones. Stefano had several years of software development experience before starting the Funambol open source project in 2003. He was one of the main contributors of the project and was also the project manager. Today, Stefano is in charge of the engineering team of Funambol. Prior to his development work on Funambol, Fornari was the chief architect at Stigma Online where he played a key role in the development of the company’s flagship portal product, SolWeb Intra. He has also held positions at Compaq, where he was an advisor on wireless technologies in PDAs, and at Art Technology Group (ATG) as a consultant. He holds an M.S. Degree in Computer Science.