Now that you've got a basic mail reader up and running, it's timeto learn a little more about attachments. This second segment analyzesMIME-encoded attachments, demonstrating how to decode and download them,and then integrates attachment handling features into the primitive mailclient previously demonstrated.
In the first part of this article, I demonstrated the basics of PHP's IMAP functions, using them to connect to a POP3 server and retrieve a list of messages from it. I also explained how to extract important message headers, showed you how to delete selected messages from the server, and gave you a crash course in PHP's session management functions.
While I have a fairly clear idea of the requirements for this application, there's still an important hole in my overall plan - I have not yet written any code to handle message attachments. This is holding up my implementation, as a number of scripts in the application will require this capability. And so, my first task today must be to understand how message attachments work, and write a few generic functions that allow easy manipulation of these attachments.
In case you don't already have the source code for the application described in this case study, you can download it here.