Home arrow PHP arrow Page 8 - Building A PHP-Based Mail Client (part 3)

Game Over - PHP

This third (and final) segment of our case study discusses theprocess of sending MIME-encoded email, demonstrating how to compose,forward and reply to email through a Web browser. It also discusses, indetail, the process of constructing a MIME-encoded message withattachments, explains PHP's HTTP upload capabilities, and examines thestandard error handler used throughout this case study.

TABLE OF CONTENTS:
  1. Building A PHP-Based Mail Client (part 3)
  2. Composing Yourself
  3. Return To Sender
  4. Coming Forward
  5. Setting Boundaries
  6. Under Construction
  7. When Things Go Wrong...
  8. Game Over
By: icarus, (c) Melonfire
Rating: starstarstarstarstar / 8
January 23, 2002

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement
And that's about it for this case study. We've covered a whole range of different things over the past couple of weeks - session management, HTTP headers and file upload, code modularization, MIME attachments, mail server connection and message retrieval, and a whole lot more - and I hope you found the process interesting and entertaining.

This case study, though slightly longer than usual, also demonstrates that application development for the Web requires a great deal more than just a knowledge of PHP. In order to develop an efficient, scalable and error-free Web application, developers must have a fundamental understanding of the protocols and design principles of the Internet, and must be able to apply this knowledge judiciously, always selecting the technology and approach that is optimal for a particular situation.

This is no easy task - it can take years to develop this approach - but the pay-off, both in terms of better-designed code and an overall feeling of satisfaction, is well worth it. Putting together this mail client was, at times, a frustrating exercise in trial and error, but I've come out the other end with a greater understanding of how email works, and a greater respect for the people whose job involves designing and implementing email solutions.

I found the following resources invaluable during the development process - if you're interested in learning more about the various topics discussed in this case, you should make it a point to visit them:

The PHP manual page on POP3 functions, at
The official POP3 RFC, at http://www.faqs.org/rfcs/rfc1939.html

The official SMTP RFC, at http://www.faqs.org/rfcs/rfc2821.html

The official MIME RFC, at http://www.faqs.org/rfcs/rfc2045.html

It should be noted at this point that this project is by no means complete. Since this prototype was introduced for internal use a few days back, a number of minor bugs have been reported, and some additional capabilities requested. Consequently, the source code provided in this article should be treated as pre-release code, unsuitable for use in production environments; I still have a ways to go before releasing this as a product to our customer.

Among the features requested: the ability to upload multiple attachments at a time; to support HTML-encoded messages; to allow sorting of the message listing by name, size, date and owner; to allow for group replies; to limit the number of files displayed per page; to change the default colours; and to display the name of the currently logged-in user. Unusual MIME attachments also tend to result in unpredictable behaviour - again, this is something that I need to debug and tune further.

I plan to continue adding features and optimizing code as and when time permits - if you'd like to give me a hand, or have ideas on how to improve the techniques discussed here, drop me a line and let me know. Ciao!

Note: All examples in this article have been tested on Linux/ig86 with Apache 1.3.12 and PHP 4.0.6. Examples are illustrative only, and are not meant for a production environment. Melonfire provides no warranties or support for the source code described in this article. YMMV!

 
 
>>> More PHP Articles          >>> More By icarus, (c) Melonfire
 

blog comments powered by Disqus
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 



© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap

Dev Shed Tutorial Topics: