So, how can I set php's mail() function to use smtp authentication?

I have a web server and then an mail server. All company's email, incoming or outgoing, passes through the mail server and I was wondering how to set the web server to use mail() function with SMTP authentication at the mail server.

Note: I need to do this globally, not to go file by file that runs the mail function in each site and start editing.

link|improve this question

55% accept rate
feedback

1 Answer

PHP's built-in mail() function does not expose functionality to make SMTP auth possible.

You would need to re-write existing code to use something like the PEAR Mail package.

Otherwise you may find it easier to set up a router on your web server's SMTP daemon to forward all outgoing mail to the mail server. In Exim, for example, this is accomplished with a smart_route definition.

link|improve this answer
these are my two only options? – w0rldart Feb 2 at 21:53
I'm sure there are other alternatives including writing your own mail function wrapper, but the built-in mail() function, on its own, has no way of doing what you are describing. – Garrett Feb 2 at 23:18
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.