General Question

richardhenry's avatar

Is sending email through an SMTP server on the same machine as my web application more or less efficient than using PHP mail()?

Asked by richardhenry (12659points) September 25th, 2008
Observing members: 0 Composing members: 0

6 Answers

andrew's avatar

I’m confused by your question. Wouldn’t PHP mail() ultimately be using whatever SMTP server you use to send mail?

richardhenry's avatar

As far as I know, it’s a built in PHP service? You can use the PHP mail function on servers without an SMTP server installed, and mail will be delivered.

The config file actually lets you specify SMTP server details, which swaps out the built-in service.

That’s the way I’ve always understood it, anyway.

tWrex's avatar

Sending it through SMTP is going to be much faster. With PHP mail you end up tying up your PHP parser along with your mail client. And @andrew is correct. The PHP mail function simply uses the mail binary present on your server (ie sendmail, postfix, or some other sendmail wrapper).

fireside's avatar

No, it looks like the mail function works with the installed SMTP

For the mail functions to be available, PHP requires an installed and working email system. The program to be used is defined by the configuration settings in the php.ini file.

tWrex's avatar

Furthermore, the reason it is slower to use the PHP mail function is because it opens and closes an SMTP socket for each mail sent. Of course if you’re just using it for a single email then whatever, but for larger mailings you’ll definitely notice a performance hit. Also using the PHP mail function can sometimes lead to missing emails.

richardhenry's avatar

Alrighty, thanks guys. Help appreciated.

Answer this question




to answer.

This question is in the General Section. Responses must be helpful and on-topic.

Your answer will be saved while you login or join.

Have a question? Ask Fluther!

What do you know more about?
Knowledge Networking @ Fluther