If you want to write PHP scripts that handle email, there are a few things you need to understand first. This article, the first of two parts, introduces you to these concepts. It is excerpted from chapter 8 of the Zend PHP Certification Study Guide, written by Zend Technologies (Sams; ISBN: 0672327090).
Although email is as old as the Internet itself, the rise of unsolicited bulk email (commonly called spam), the increasing number of modern viruses that transmit themselves via email, and the fraudulent use of genuine email addresses for criminal intent mean that we are at the start of a period of great change in how email will be delivered in the future.
Junk email filters have become very popular. They can be added both to the MTA and/or the MUA. It's a fair bet that most of the email that these filters mark as 'junk' never gets read by a human. Junk email filters aren't perfect; genuine email that looks very like real junk email will also get marked as junk. When you roll out a PHP application that sends email, you should perform some tests with your customer to make sure that your email will get past whatever junk email filter your customer uses.
Because of repeated security holes in MUAs, the more tech-savvy businesses and users do not accept delivery of HTML email. It's very tempting to send HTML email—such emails look so much nicer than plain-text email. You should ensure that any PHP application you write that sends email always gives the user the option to choose between plain-text email and HTML email. You should never only support HTML email.
If you write and sell PHP software that works with email, it's important that you keep abreast of the new technologies that are always coming out. When capturing requirements from your customer, always make sure that you've agreed what email technologies the customer has adopted—or is planning to adopt within six months of the end of your project. The customer will (somewhat naively) expect your PHP application to work perfectly with whatever changes he plans to make to his email infrastructure—and will blame you if it doesn't.