Jump to content

Recommended Posts

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

 

Link to comment
https://forums.phpfreaks.com/topic/255030-php-5-emailing-solution/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.