I spent about a day creating a basic mailer class until I decided that there had to be a much better implementation created by a third party. Whilst it was interesting to have to iron out the bugs in the examples I found on the internet ultimately I wanted a solid, secure platform for both myself and my customers. There are a lot of code snippets on the internet that just are not up to the job…
So, the one to use is PHPMailer from Codeworx Technologies. Find their link here and access the script from their SourceForge page
For reference my functional example is located here
Let me know if you require a more detailed explanation of how it works.
Update: this page has been getting a few views, so it is obviously something that people are interested in. As of this edit (20/05/2010) the version is 126.96.36.199
- Supports emails digitally signed with S/MIME encryption!
- Supports emails with multiple TOs, CCs, BCCs and REPLY-TOs
- Works on any platform.
- Supports Text & HTML emails.
- Embedded image support.
- Multipart/alternative emails for mail clients that do not read HTML email.
- Flexible debugging.
- Custom mail headers.
- Redundant SMTP servers.
- Support for 8bit, base64, binary, and quoted-printable encoding.
- Word wrap.
- Multiple fs, string, and binary attachments (those from database, string, etc).
- SMTP authentication.
- Tested on multiple SMTP servers: Sendmail, qmail, Postfix, Gmail, Imail, Exchange, etc.Good documentation, many examples included in download.
- It’s swift, small, and simple.