3

I am new to PHP and I am not sure which email library I should use. I have read about PHPMailer, SwiftMail and the PEAR library.

I require

  • SMTP authentication
  • Send as html
  • Add attachments

Can anyone tell me which library is best?

Another question: is there a mail library which supports sending mail in a background queue?

Treffynnon
  • 21,365
  • 6
  • 65
  • 98
Fuxi
  • 7,611
  • 25
  • 93
  • 139
  • http://stackoverflow.com/questions/4920973/php-looking-for-email-library-which-supports-message-queuing – Haim Evgi Mar 31 '11 at 09:40

3 Answers3

6

SwiftMailer developed by Chris Corbyn of devnetwork forums :)

J Bourne
  • 1,409
  • 2
  • 14
  • 33
  • SwiftMailer is now a part of Symfony (bundles?) and I believe Fabien Potencier has taken over http://fabien.potencier.org/article/33/swift-mailer-takeover – Treffynnon Mar 31 '11 at 10:03
  • I think it said Fabien Potencier as a Project Manager, and I don't think it means complete ownership is to Fabien. Did it mean so? – J Bourne Mar 31 '11 at 10:07
  • You are correct and just to clarify I never said that complete ownership was handed to Fabien. I was merely pointing out that Chris is not leading the project any more. – Treffynnon Mar 31 '11 at 10:09
2

SwiftMailer or PHPMailer are good libraries for sending out emails and both contain methods for HTML and attachments. PHPMailer is slightly on the lighter side in terms of file size.

As for your background queues question. I am using a combination of Gearman (PHP man page) and Redis in an application I am writing at the moment. If your requirements are less heavy duty then you could always make use of the Linux at queue to send out your emails. I have written a PHP wrapper class for the at binary so that could do this easily from PHP. See https://github.com/treffynnon/PHP-at-Job-Queue-Wrapper

Using at will also allow you to schedule a particular send out in the future. This is something that Gearman is currently unable to do on its own as I discovered in my question Schedule a job in Gearman for a specific date and time.

Community
  • 1
  • 1
Treffynnon
  • 21,365
  • 6
  • 65
  • 98
0

If you were thinking of going with PHPMailer, you might want to look at PostageApp, which has a very simple and easy to use API (Used it on one of my projects!) and can do just about everything you are looking for.

In addition, you can design templates and add the content with an API call. I really like this because it automatically in-lines HTML and CSS into the body of the email.

Let me know if you have any questions!

(Full Disclosure: I'm the Product Manager for PostageApp!)

JonLim
  • 1,393
  • 2
  • 14
  • 23