Should I use PHPMailer or SwiftMailer? [duplicate]
Asked Answered
E

3

11

Possible Duplicate:
PhpMailer vs. Swiftmailer?

I have always used PHP's built in mail() function and it has always worked for me without fail and does the job I want it to.

Now some maybe thinking 'Why fix something that isn't broke ?'.

My answer to these in case someone asks is:

  • I have never used a framework before if that's what they are classified as or perhaps they are called a library I don't know.

  • I want to start using one and have looked over the documentation and both seem very easy to use.

  • As I implement new features into my site, my site is depending more on sending emails etc meaning PHP's mail() function is not up to the job any more.

  • They would be easier to use when dealing with advanced things like attachments, html and text versions etc; that would otherwise be difficult or impossible using PHP's mail() function.

  • I have never used SMTP, and I have looked into it and I can see I can use it along with SSL on my hosting package. After plenty of reading it seems that not only is SMTP more reliable and more widely used, emails are less likely to be marked as spam, using either of the frameworks will improve performance, reliability and more secure because it uses SMTP with SSL.

Now I am not sure what the other benefits are using SMTP, maybe someone could give me some more reasons why it's better? I am looking to find out more information about SMTP benefits.

I have looked at both documentation looked at the features they both offer, searched google for PHPMailer vs SwiftMailer but not found anything saying why one is better than the other.

Does anyone have experience with any of them?

Does one have more benefits than the other?

Would you say one is better than the other?

I did read a lot of people saying PHPMailer was a dead project but those posts was relatively old. Looking at PHPMailer's website it seems the project is and has been back in development for some time now.

Thanks for anything you can provide on either PHPMailer and/or SwiftMailer. Hopefully I can decide on one or the other as at the moment I have no reason on why I would choose one over the other.

Engen answered 18/4, 2011 at 20:10 Comment(0)
B
5

I've used PHPMailer for my projects and have no complaints about it. Haven't used Swiftmailer, but both seem to be pretty much the same in terms of usage and usefulness, differing only in implementation details. When you get right down to it, they're both just friendly interfaces to hide the details of SMTP email from you.

Pick whichever one whose style suits you best and go with it.

Brezhnev answered 18/4, 2011 at 20:14 Comment(1)
B - Thanks for this, it has helped me decide. Funny thing i was playing about with PHPMailer as i thought i would start with PHPMailer to test drive and must say it was a doddle setting up, created a function in minutes myself to use wherever needed on my site and dead simple to use :) I guess it's PHPMailer for me then. Thanks!Engen
H
21

I say absolutely Swiftmailer.

  • It is written in PHP 5 and component-based; PHPMailer is PHP 4

  • It has a cleaner web site with better examples

  • It has better documentation

  • It has only one version flying around the Internet and not at least two, like PHPMailer has.

Hannibal answered 18/4, 2011 at 22:14 Comment(5)
Maybe i am getting it wrong but PHPMailer has a version for 4 and a version for 5/6. I downloaded the version for 5/6.Engen
@Engen judge for yourself, here are 2 basic usage examples of both classes... PHPMailer Vs SwiftMailer ...is not so hard to know which was my choice { aka SwiftMailer } =PCarolinian
Glad to see positive comment from Pekka, I'll go with Swiftmailer too.Salian
Completely changed my mind, PHPMailer is better, for details see https://mcmap.net/q/299085/-phpmailer-vs-swiftmailer-closedSalian
both hands up for @Hannibal :)Homiletics
B
5

I've used PHPMailer for my projects and have no complaints about it. Haven't used Swiftmailer, but both seem to be pretty much the same in terms of usage and usefulness, differing only in implementation details. When you get right down to it, they're both just friendly interfaces to hide the details of SMTP email from you.

Pick whichever one whose style suits you best and go with it.

Brezhnev answered 18/4, 2011 at 20:14 Comment(1)
B - Thanks for this, it has helped me decide. Funny thing i was playing about with PHPMailer as i thought i would start with PHPMailer to test drive and must say it was a doddle setting up, created a function in minutes myself to use wherever needed on my site and dead simple to use :) I guess it's PHPMailer for me then. Thanks!Engen
M
-2

The only time I had to stray from the mail built-in function was when I needed to send an email from authentic "Gmail" account (client was receiving mail from our app in his spam folder).

In this case I used PEAR's Mail Extension which was really easy to use:

http://pear.php.net/package/Mail

Martinmartina answered 18/4, 2011 at 20:17 Comment(1)
The built-in function opens a smtp connection for each email it sendsCythera

© 2022 - 2024 — McMap. All rights reserved.