ankitjaininfo
ankitjaininfo

Reputation: 12362

PHP: mail() vs SendMail

a simple question: which one has good performance for sending mails in bulk?

mail() function or sendmail

which one is used by popular PHP list manager packages?

Upvotes: 13

Views: 24225

Answers (3)

Byron Whitlock
Byron Whitlock

Reputation: 53850

If you are running the SMTP mail server yourself, make sure you have SPF and domain keys set up properly or your mail will end up in the junk box for most large domains (yahoo, gmail etc).

Also don't forget about bounce handling and robust unsubscribe functionality. Without those your email blasts will be much less effective, and your IP will get blacklisted.

And of course don't allow open relays. Do your homework and tread with caution, spammers have made it difficult for us.

Upvotes: 3

Jordan Ryan Moore
Jordan Ryan Moore

Reputation: 6887

sendmail is a Mail Transfer Agent (MTA). On UNIX and Linux based systems, PHP's mail() function simply relays the email though sendmail (or a compatible MTA). For sending bulk email, you may want to look into directly connecting to an SMTP server. Zend Framework provides an SMTP transport.

Upvotes: 8

Percutio
Percutio

Reputation: 954

Well the mail() function is not really suitable for emails sent in bulk because it opens and closes an SMTP socket for each email you send, which is far from being efficient. If you look at PEAR::Mail it allows you to use 3 backends: mail, sendmail and plain SMTP. For what it's worth, I've personally preferred SMTP because it's easy to support on both Linux and Windows.

If you wish to send mails in the background using a queue, PEAR::Mail_Queue might be a solution.

Upvotes: 12

Related Questions