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.
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:
It works for me.
It's not possible, AFAIK. I would either:
msmtp can be used as an alternative to sendmail which simply forwards traffic directly to an external SMTP server. It's pretty easy to set up and works very well.
You can either use PHP's inbuilt IMAP tools or the very handy PHPMailer
This could be better answered on Stack Overflow I fear...
PHP on Linux relies on sendmail. I would recommend using a different mail function from another library if you really want to do this. There are recommendations on the following StackOverFlow Post: https://stackoverflow.com/questions/966907/specify-smtp-server-for-php-mail-in-freebsd
PHP by itself can't do this.
Simple forwarders such as ssmtp have some problems relaying php mails.
http://www.freehackers.org/thomas/2008/07/13/linux-a-second-class-citizen-in-the-php-world/
The internal mail() function can only use SMTP on a Windows machine like you have said.
The only option is using PHPMailer. You can also try the PEAR PHP package: http://pear.php.net/package/Mail
https://docs.nexcess.net/article/how-to-configure-a-remote-mail-server.html From the SiteWorx main menu, click Administration > Mail Options > Remote Setup. - See more at: https://docs.nexcess.net/article/how-to-configure-a-remote-mail-server.html#sthash.JeroEsDU.dpuf