There's a quick post from Mike Wallner today with a helpful IMAP hint for those working with attachments - and his solution.
If you -like me- were suffering from being unable to load big attachments through ext/imap because of PHPs memory limit, the new imap_savebody() function should be what you were looking for. It adds the ability to save any section (full mail, too) of a mail message to a file or stream.
You can see the proposal for the functionality on this Zend page, including some of the suggestions others made and its inclusion into The PAT direectory. You can view the source here...