O'Reilly logo

Core PHP Programming, Third Edition by Leon Atkinson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

24.4. Email with Attachments

Sending plain email with PHP is easy. The mail function handles all the messy protocol details behind the scenes. But if you want to send attachments, you will need to dig into an RFC, specifically RFC 1341. This RFC describes MIME, Multipurpose Internet Mail Extensions. You can read it at the faqs.org site <http://www.faqs.org/rfcs/rfc1341.html>, but I'll show you a somewhat naïve implementation.

There are several example implementations to be found on the Web. Check out David Sklar's networking section <http://px.sklar.com/section.html?id=10>. Most of these put functionality into a class and attempt to incorporate every aspect of the standard. Listing 24.6 contains code that sends email with multiple attachments ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required