Martijn's PHP Coding Blog


November 24th, 2009

Using PHP to upload E-mail to Google App Mail - 2

Using PHP to upload Thunderbird to Google Apps Mail

Google Apps has great benefits for small companies. There is little need to maintain your own IT infrastructure, a simple ADSL line attached to a tiny internal network is sufficient for the majority of tasks.

But how do you move an existing company to Google Apps?

A company I have been working with uses Thunderbird for its e-mail.

Moving should have been straightforward as Google provides their own migration tool : the e-mail uploader.

The development of this program however appears stagnant and its bugs are not being fixed. Strange considering how important Google Apps must be for Google.

For me the problem was that 40-50% of the Thunderbird e-mails in the mail store were not being uploaded because the Google Uploader complained that there was something wrong with the date format.

The bug related to this has been open for over a year.

If I wanted to continue I needed to find my own solution or give up on migrating altogether.

A quick browse through the Zend Framework manual showed that it can read MBox files (Thunderbirds mailbox format) through the Zend_Mail_Storage* class and communicate with Google using the Zend_Gdata* classes.

The exercise left was to bind it all together into a working PHP script that would take my mailboxes and upload them to Google.

Having done this and having succesfully uploaded several multi-Gigabyte sized mailboxes I have uploaded my code (’googlemailappuploader’) to Google Code.

If you find yourself in a similar situation — I hope you find it usefull. Leave me a comment if something is unclear.