Start New Discussion within our Web Development Community

I have trid the testing script as follows:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
$headers = ''. "\r\n" .
    'Reply-To: [email][/email]' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();
$ret=mail('', 'subject', 'this is the content',$headers,'');
echo "<BR/>mail() returned: " . ($ret? "TRUE" : "FALSE") . "<BR/>";

This script works fine at another Linux server. But in the windows server i am using, the result is:

mail() returned: TRUE

but sending no mail at all.

The server setting is like:

Directive	      Local Value	               Master Value
sendmail_from	[email][/email]	[email][/email]
sendmail_path	     no value	                       no value
smtp_port	             25	                                25

I can't locate the problem cos I don't have access to server config...
Someone please tell me where the problem is..Thanks

I found the solution by myself:

ini_set("sendmail_from", "");?>

at the beginng of mail testing file.....

For all of the people struggling with getting PHP mail() sending to some, but not all, recipients...look no farther. Your solution has been posted here.

It appears PHP-generated emails don't play nice on Windows mail servers. So, when your mail goes to anyone who uses a Windows mail server (Comcast, gmail, and maybe aol), the recipients won't get it. UNLESS YOU ADD THE LINE:


phpini_set("sendmail_from", "");


This is a miracle! I have been scouring the internet high and low, and this is the ONLY thing that has worked! Now I can move on to the rest of the project!

Thank you, MeixiuLin! Thank you, thank you.

hi sir, i m also facing php email setting problem it show that mail() returned: TRUE, but its not sending mail, pls help me

I have a problem sending mails from my Windows Server. I am using IIS 7 and PHP 5.3.18
I would like to know if I need to configure my PHP.ini and how do I have to do it?
Thanks a lot for your help.

i need a send email code for windows server.Help me as soon as possible.

Above suggestion is not working with my code and windows server.plz give me actual solution.

i used window server and deploy php. I have smtp server to relay the email. I don't know where to configure it.

This question has already been answered. Start a new discussion instead.