Php – How to configure php.ini with remote SMTP

PHPphp.inisendmailsmtp

How do I configure PHP to send mail using mail() via a remote SMTP server?

I've tried to do this using php.ini but it seems that you can only do that under Windows32 and I want to do this on my Unix server.

Also I've tried to change the configuration for sendmail so it would use a remote SMTP server but I'm not sure that's possible.

Best Answer

My choice is setup a postfix server in the same web server that sent mail only for localhost and with this setting in main.cf to use a remote SMTP server:

relayhost = [a.b.c.d]

It works for me.