I'm building a fairly simple PHP script that will need to send some emails with attachments. I've found these 2 libraries to do this.
Does either one have significant advantages over the other? Or should I just pick one at random and be done with it?
PHPMailer is perhaps the most popular open-source PHP library to send emails with. It was first released way back in 2001, and since then it has become a PHP developer's favorite way of sending emails programmatically, aside from a few other fan favorites like Swiftmailer.
PHPMailer does not set any limits, nor does the mail() function, it's only ISPs like GoDaddy that do. However, they do so by blocking access to normal SMTP ports, and/or redirecting SMTP connections to their own servers ( *.
PHPMailer doesn't create/use any SQL itself, nor does it have anything to do with javascript, so it's secure on those fronts.
I was going to say that PHPMailer is no longer developed, and Swift Mailer is. But when I googled ...
https://github.com/PHPMailer/PHPMailer
That suggests its being worked on again.
I've used PHPMailer a lot, and its always been solid and reliable. I had recently started using Swift Mailer, for the above reason, and it too has given me no trouble.
Now that PHPMailer is developed again, I think I'll probably give the new version a try.
So, my answer is that both are capable, and that it doesn't matter that much – choose one, learn it, use it. Both offer massive advantages over mail() and abstract away the nuances of email so that you can get on with whatever you are really trying to develop.
Whatever the features are, they have variety in their applicable licenses:
PHPMailer - LGPL 2.1 (https://github.com/PHPMailer/PHPMailer)
SwiftMailer - MIT license (https://github.com/swiftmailer/swiftmailer)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With