This guide is for setting up php mail function with microsoft exchange server 2003.
This guide should also solve the new user sign up problem.
Example: I have installed phpws successfully, edited the php.ini mail section setting. However, I can only sign up with email address that is inside your domain, and if you use any externally email address, you will get the "sorry, our email is having problem" error message from " from phpws.
Solution. Even you have the correct php.ini mail () settings, such as smtp port number, and your smtp server name on the mail() function section, phpws or any phpscript will ONLY be able send emails inside the domain. So you must configure a setting called "relay client" on the exchange server, and this should enable your webserver to connect to exchange, and have exchange send out internal AND external emails.
Before we start, lets go over our setups and requirements:
A. Domain controller = Windows server 2003, Exchange = MS Exchange server verison Enterprise 2003
B. Webserver is IIS 6.0, php 4.4.3, mysql 4.0
C. I assumed you have full administrator right on you webserver and exchange server.
D. This guide will work if you install phpws on the live webserver or a test localhost webserver.
Good news, this is really simple =) and you don't have to touch any phpws files settings!!!
You will only need to change 2 settings.
1. The php.ini, mail() section.
2. Configure access setting in your exchange relay setting.
A. Open up the php.ini file on your webserver
1. Go open up your php.ini file in notepad. The following setting will work on your webserver or test server(localhost) if you give proper access to the localhost computer.
2. Find the mail function see picture:

3. Smtp = server01, server01 is my exchange server name, you can use name or IP address
4. smtp_port = 25
5. sendmail_from = [email protected]. I created this dummy user to send email out, you can use your own email if you want.
Asumming, I used [email protected], and that was working also. This must be a user created in your active directory
6. After edittng these settings, do an iisreset or reboot your webserver.
B. Now lets go edit the setting on exchange server:
1. Open up exchange system manager, go to your smtp folder, right click on properties on default smtp virtual server.
2. Go to relay next to relay restrictions:
Once the radio button for the "Only the list below" is highlighted, we can add the webserver ip or your localhost's IP, so click on the add tab.

3. Now you will have to add the webserver and your localhost ip on here (if you don't use a test webserver localhost, then you will only have to add your live webserver ip
4. Once you are done, click ok, and ok, or just close exchange system manager.
C. Testing
1. Now lets use a php script, and run it on your webserver, we will send 2 emails out with this script, 1 email will be sent to an internal email, another one will be an external email.
Script:
<?php
$to = "[email protected]";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body))
{
echo("<p>Message successfully sent!</p>");
}
else
{
echo("<p>Message delivery failed...</p>");
}
?>
you can get the script on there too:
http://email.about.com/cs/phpemailtips/qt/et031202.htm
Change [email protected] to your email address, so mine is [email protected]
So just save it as .php, and view it on any browser, whenever you view the page, it'll send an email to that email address
Hopefully you will get an email in your outlook inbox
2. This time we will test external email, so use the same script, but change [email protected] to [email protected] or [email protected].
save it as .php on webserver, view it, and that will send an email to yahoo or hotmail email address.
Thats it, as long as you can send an email internally/externally with that php script, then the new user sign up should work.
3. From this problem, I guess you need to use exchange server to give permisson to the webserver, so now the webserver can use exchange to send external emails out. This must be used to prevent spam emails?
4. If I am wrong on any part on this guide, please email me and correct me. Thanks! I am fairly new to the system admin field, please let me know if this guide has either help you or not.
I got the tips on exchange from this website if you guys are intersted.
http://episteme.arstechnica.com/groupee/forums/a/tpc/f/469092836/m/1960938145