I have trid the testing script as follows:

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

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]me@localhost.com[/email]	[email]me@localhost.com[/email]
sendmail_path	     no value	                       no value
SMTP	              213.200.51.11	         213.200.51.11
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:
put

<?php
ini_set("sendmail_from", "info@mydomain.com");?>

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", "info@mydomain.com");

?>

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.

Excellent Solution by MeixiuLin, its working , keep it up :)

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.

This post is dead, dont bring it back. Besides, dont hijack peoples post.

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

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

Member Avatar for fateenalkhred

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.