Swift Mailer: Awesome PHP Mailer

Saturday, January 2nd 10:44pm Matt
Swift Mailer PHP emailer

Tonight was the first time that I needed to write some code for a business that would send email to customers, or at least email that needed to be reliable and feature rich. I looked at the documentation for the PHP mail function and after a lot of reading realized it was not going to work. If I wanted to use HTML, that involved a lot of uncertainty, if I wanted to use UTF-8, that involved a lot of uncertainty. There were a lot of unknowns but one thing that was quickly becoming a known was that I was not going to fix this problem.

I knew I could send simple text emails with a URL to details if I had to, but before I did that, I wondered if someone else had solved my problem since what I wanted was reasonable and obvious. To my great surprise a few people had. It came down to two tools, Swift Mailer and PHP Mailer.

After doing some Google searches and research, it became clear that Swift Mailer was probably going to be better for me. And the reasons why are big lessons for PHP Mailer. Swift Mailer had a nice simple website, they had one product, and they had a download link on the front page. Right off the bat, it was looking simple. On the other hand PHP Mailer has four products which I would have to investigate to find out which one was right for me. Their home page is a mess that for some reason seems to focus on ads for other people’s products along with tons of text about who knows what. It would take me hours just to parse the homepage.

But, what took it over the edge was that Swift Mailer has a beautiful object oriented design to their API and they talk about that being a goal, they have full easy to understand documentation, installation is a breeze, as it should be, all while offering an incredibly feature rich product. Swift Mailer wins by a mile.

Was it as easy as it looked? Well, in about an hour I had built a WordPress plugin that would include Swift Mailer’s functionality in my blog on demand. I had added code to another plugin to enable Swift Mailer at the right time and send an email from one Gmail account to another using Gmail’s smtp server with a secure connection over SSL.

One hour.

I literally copied the code over and changed the important bits. I had one issue where Gmail didn’t like the port the Swift Mailer docs used for SSL, but the Gmail docs listed the alternative port and things worked perfectly.

Furthermore, there are tons of features of Swift Mailer that will actually inspire me to do more with email.

Kudos to the Swift Mailer team, you’ve really created a great product and you are a poster project for open source. Thank you!

Submit a Comment