I would like to send an email from my PHP application. For this, I set up my website in IIS on my Windows server 2008. Can I install the Windows SMTP server.
Then I create a test page to send an email:
<?php
Ini_set ('SMTP', 'localhost');
Ini_set ('sendmail_from', '[email protected]');
$to = '[email protected]';
$subject = 'Example subject';
$body = 'body ... With an example';
if(mail($to, $subject, $body)){
echo "Successful";
}else{
echo "Error";
}
?>
I also configure php.ini and SMTP E-mail in IIS like this:
[Mail function]
smtp = localhost
smtp_port = 25
Then I test sending my mail. When I send the email to an email address of the local domain to another email address in the local domain. Me back my page "Successful" and the email goes in the folder :
C:\inetpub\mailroot\Drop
By cons, if I send an email from an email address in the local domain email address to an external domain (@ hotmail.com). Me my page returns "Error" and nothing happens.
I look at the log files of my SMTP server, but there is no error message.
Can you help me?
display_errorssettings and see if PHP reports some error. - Salman A