Fix for Sending Email with Funambol and Schedule World

Fix for Sending Email with Funambol and Schedule World

Those of us without a Blackberry Enterprise Server cannot automatically synchronize our calendar and contacts with our PC without directly pluging the Blackberry directly into the PC with a USB cable. This is where Funambol and ScheduleWorld come in. ScheduleWorld is a SyncML server, basically a Calendar and Contacts server. Funambol is an open source SyncML client for the blackberry. By using both of these programs you can sync your calendar and contacts to your PC over the air, without directly connecting your Blackberry to your PC. There are numerous tutorials for how to set this sytem up so I won’t waste your time discussing it here.

However, the Funambol ScheduleWorld setup has had one main issue for over a year. The problem stems from the fact that Funambol also allows for the synchronization of email while ScheduleWorld does not. Funambol allows users to unselect mail from synchronization. But even with mail unchecked Funambol still does some check of the mail which causes an error. Currently users will get the following error when sending an email:

Sorry you can't synchronize "mail", because the name of 
the Remote Mail in the Funambol configuration panel
mismatches the corresponding name on the server.

Users then had to select "resend" to force their email to send. Needless to say the whole process was very annoying. Funambol is an open source project so I decided to take a look.

Funambol is written entirely in Java, a language I have only moderate experience with. After reading the code for about an hour I found a sendMessage function that looked like it could be causing the problem. For some reason this function does not check if mail is configured for synchronization. Therefore all I needed to add was a simple conditional statement to check for the syncMail setting. The result is as follows:

    public boolean sendMessage(Message msg) {
try {
if (Configuration.syncMail) {
StaticDataHelper.log("Persistent store: " + PersistentStore.getSynchObject());
StaticDataHelper.log("Number of objects in storage: " + String.valueOf(Memory.getPersistentStats().getObjectCount()));

msg.setStatus(Message.Status.TX_PENDING, 0);
// Reset the draft flag in case it was a sent draft
msg.setFlag(Message.Flag.SAVED_THEN_ORPHANED, false);

//bug fix 1113
if (inSynchronize) {
StaticDataHelper.log("[INFO]sendMessages: another sync in progress...");
// FIXME: what to say to the user? Wait for the sync to stop?
return false;

new Thread() {
public void run() {
inSynchronize = true;
try {
// Send the message
synchronizeMail(); // FIXME: synchronize(SYNC_MAIL)?
// Move it to SENT if successful
//catch (Exception e) {
catch (Throwable e) {

Log.error("[LOG]Exception in SyncClient.sendMessage: " + e.toString());


// TODO: set the message status to TX_ERROR

finally {
inSynchronize = false;

finally {
* FIXME: check if this statement
* is reached before the thread
* above is started
return false;

I added the lines in green and indented the lines in blue.

I tested this solution using the Blackberry simulator included with JDE and it appears to work perfectly. However, you can never be sure how well a simulator really emulates the real product. Currently I am just waiting for a Signature Key, that I purchased from Blackberry for $20. Once I receive this key I will be able to sign the code and install it on my Blackberry.

One thought on “Fix for Sending Email with Funambol and Schedule World

  1. Kevin: Funambol is not just a client, but also a full syncml server. ScheduleWorld runs a custom version of Funambol older code (when it was called Sync4j). Soon there will be news from Funambol about the Blackberry client 🙂 Keep in touch with Funambol and try also our gratis sync service on Cheers.

Leave a Reply

Your email address will not be published. Required fields are marked *