views:

154

answers:

5

Hi I have been reading alot of articles adoring the PEAR mail package and it seems like PEAR is something I need to try out.

I am interested in setting up a full mail server, similar to a conventional SMTP mail service; which incorporates mail queuing, resending with a backend database etc. My impression is that PEAR can do this but can its service be used with mail clients like outlook to send mail, just as how any any smtp server daemon can where one would enter a portnumber, server name and/or security protocol?

Thanks

+7  A: 

No, PEAR isn't going to magically solve these problems for you.

PEAR is a collection of PHP classes that are meant to solve common problems faced by PHP users. The Mail packages offer code for interacting with different parts Email systems. They do not contain code for creating email systems from scratch.

For example, form the Mail_Queue documentation

The Mail_Queue class puts mails in a temporary container, waiting to be fed to the MTA (Mail >Transport Agent), and sends them later (e.g. a certain amount of mails every few minutes) by >crontab or in other way.

The MTA in this case in sendmail, postfix, etc.

Another example, from the Mail_Mbox documentation

It can split messages inside a Mbox, return the number of messages, return, update or remove an specific message or add a message on the Mbox

Incorrect use of "an" aside, you are using this to read existing MBOX files, and not caring how they got there.

The Mail package is about interacting with existing mail systems, NOT creating replacements. You'll still need to understand how all those email systems work to create a "full mail server, similar to a conventional SMTP mail service". If you're doing this because you want to learn how email systems work, have at it. If you're doing this because you thing this will give your business some leg up in the email game, I laugh and say "good luck with that"

Alan Storm
+4  A: 

PEAR is a repository for lots of libraries. Some of them deal with mailing.

troelskn
+2  A: 

PEAR's Mail class is designed for sending mail only. It is not designed as an implementation of an SMTP server.

Mark
+1  A: 

Pear Mail is an SMTP sender aka client, not an SMTP server. Although it's entirely possible to write server (any kind of server) in php that doesn't mean that writing an SMTP server yourself is necessarily a good idea as it requires quite some expertise to do it right (spam anyone?). If you want to see an SMTP server implemented in a scripting language, go have a look at Lamson, written in Python by Zed Shaw.

And while you're there, do read the About page. This quote says it all

However, as great as Lamson is for processing email intelligently, it isn’t the best solution for delivering mail. There is 30+ years of SMTP lore and myth stored in the code of mail servers such as Postfix and Exim that would take years to replicate and make efficient. Being a practical project, Lamson defers to much more capable SMTP servers for the grunt work of getting the mail to the final recipient.

fvu
Ok, maybe I don't need a real, full scale implementation of a SMTP service because as you rightly said that maybe too much for one person. In that case then, I will settle for the capability to just manage the sending of mails from a database .e.g. what if a script sends a mail and for some reason the recipient was unavailable, it needs to queue those undelivered mail for resending. Looking at the two options you mentioned, I am assuming you are suggesting that pear might be the better alternative since Lamson might not be as reliable. Do you concur?
megatr0n
+1  A: 

It seems to me that PEAR's MailQueue package may address your needs.

kguest