ushahidi/Ushahidi_Web — Issue #230: IMAP fixes - more efficient fetching, more robust attachment handling
Author: aoduor
Created: 2012-02-16 17:49:00+00:00
State: open
Labels: Bug, P4 - Normal

Hi!

I've attached a patch which does the following:

- Uses imap_search() to find the 'UNSEEN' messages. This is more efficient and the code to only fetch a limited number of messages at a time is re-enabled.

- Uses the type and subtype to resolve the attachments instead of the file name extension. I found that different phone models (when sending MMS to email), different carriers (when sending MMS to email), and different email clients do not reliably add extensions or even provide a sane filename. However, they all set the content type correctly and PHP was able to identify the mime type as image/*.

- When you MMS to an email address, sometimes the source carrier wraps the message and the image into html with some embedded GIFs. The patch only allows images > 12.5k to be accepted.

- If someone MMS's an image without a subject or text, it was not possible to preview this image in the message review on the admin interface. This was a on line fix.

A suggested patch is attached. Should I submit a pull request instead of posting here?

http://dl.dropbox.com/u/31224372/imap-fixes_2011-05-09.patch" - Martin