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

Re: PHP Mail function not working in Windows Server 80 80

I found the solution by myself:
put

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

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

Re: PHP Mail function not working in Windows Server 80 80

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.

Re: PHP Mail function not working in Windows Server 80 80

Guys, i love you.

Re: PHP Mail function not working in Windows Server 80 80

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

Re: PHP Mail function not working in Windows Server 80 80

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

Re: PHP Mail function not working in Windows Server 80 80

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.

Re: PHP Mail function not working in Windows Server 80 80

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

Re: PHP Mail function not working in Windows Server 80 80

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

Re: PHP Mail function not working in Windows Server 80 80

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

Re: PHP Mail function not working in Windows Server 80 80
Member Avatar

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 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.