Monday, 15 November 2010

PHP Mail By Different SMTP Server


I've just had to upload a php website to an IIS 6 web server. Amazingly, everything worked apart from the ability to send email. I informed the hosing provider and they set up a different SMTP server to send email from. I now needed to tell my website where the different smtp server resided.

The Solution

I used the ini_set command in php. It allowed me to override the default php setup, and add it to a config file. I believe this can also be achieved by .htaccess, however having the setting in a config file in php suited me better.




Note: The ideal solutions would have been to have php.ini changed, but this solution works for now.