kicken Posted January 14, 2012 Share Posted January 14, 2012 Hi All, I'm looking for any suggestions for a library to use for composing and sending emails in PHP. Here's my main feature requests: - Sending via SMTP (with auth) - Mime support (html/text parts, attachments) - Separate classes for message generation/mail delivery The reason I want separate classes for the delivery and the message generation is because I want to be able to have to separate delivery types for use on the site: 1) Instant delivery where the mail is sent to the smtp server right away 2) Queued delivery where the mail is stored in a queue (database or similar) and sent later (by a separate process). The instant delivery will be used for messages such as a registration confirmation or password recovery link. The queued delivery is for mass and low priority mailings (eg, news letters, automatic notifications, etc) so the users do not have to sit and wait while the mails go out. So what I had in mind was to create an EmailMessage class where I set properties/use methods that generate the full message (headers/body) and a EmailDelivery class that will handle sending the message via whichever delivery method I choose for that instance (instant vs queued). My EmailMessage class would just use the Mime generation abilities of the library while the instant delivery implementation would use the mail delivery part (smtp class). From my quick looking around PHPMailer seems popular, but it's all-in-one without the separation I was hoping for. It seems also that it would not be easy to just plug in a different transport agent to use as my queued delivery. It seems to be hard-coded for it's transports rather than plug-n-play style. The PEAR classes are separated like I want, but I find their API's to be a bit clunky to use. It is also designed for PHP4 and causes a few warnings (eg, from using $obj =& new Class()) out of the box. They can be fixed, but I prefer not having to modify the library's core files. I'm not currently using any framework, and I'd prefer to avoid bringing in a full framework just for email classes. Looking for any suggestions on solutions that fit my desires. Also open to suggestions on my proposed setup if anyone has any, or knows of a library that might work well with a slight design change. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/255030-php-5-emailing-solution/ Share on other sites More sharing options...
kicken Posted January 15, 2012 Author Share Posted January 15, 2012 I ended up finding SwiftMailer which seems to have the features that I want. I've setup a spool transport that saves the messages in the database, and then I can read them out later to send them out. Quote Link to comment https://forums.phpfreaks.com/topic/255030-php-5-emailing-solution/#findComment-1307761 Share on other sites More sharing options...
trq Posted January 15, 2012 Share Posted January 15, 2012 Yeah SwiftMailer is the component that Symfony2 uses. I was going to suggest using Zend's Mail components but it would have been more of a hassle to pull out of the framework. Quote Link to comment https://forums.phpfreaks.com/topic/255030-php-5-emailing-solution/#findComment-1307783 Share on other sites More sharing options...
jeevanism Posted January 18, 2012 Share Posted January 18, 2012 I am using Rmail class for sending Emails. Its very simple and powerful email class for php. it supports multiple authentication methods and attachment system etc. refer this link more info:- http://forums.digitalpoint.com/showthread.php?t=1652514 Quote Link to comment https://forums.phpfreaks.com/topic/255030-php-5-emailing-solution/#findComment-1308759 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.