views:

2318

answers:

4

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?

+4  A: 

There is also Zend_Mail. If I had to pick one for a new project today, I would seriously consider that.

troelskn
A: 

have a look at: phpguru.org, and the PEAR Mail class

William Macdonald
+14  A: 

I was going to say that phpmailer is no longer developed, and swiftmailer is. But when I googled ...

http://phpmailer.codeworxtech.com/

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 swiftmailer, 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.

benlumley
+4  A: 

I've used PHPMailer on many projects and never had a problem. It's feature complete and it has good docs.

I had never heard of Swiftmailer so I took a peek at the website. It seems a nice solution too.

If your needs are simple as you say, then just pick one at random.

daremon