PHP Mail function not working in Windows Server

Thread Solved

Join Date: Jun 2008
Posts: 2
Reputation: MeixiuLin is an unknown quantity at this point 
Solved Threads: 0
MeixiuLin MeixiuLin is offline Offline
Newbie Poster

PHP Mail function not working in Windows Server

 
0
  #1
Jun 11th, 2008
I have trid the testing script as follows:
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <head>
  4. </HEAD>
  5. <BODY><?php
  6. $headers = 'From:info@mydomain.com'. "\r\n" .
  7. 'Reply-To: [email]info@mydomain.com[/email]' . "\r\n" .
  8. 'X-Mailer: PHP/' . phpversion();
  9. $ret=mail('user@customer.com', 'subject', 'this is the content',$headers,'-finfo@mydomain.com');
  10. echo "<BR/>mail() returned: " . ($ret? "TRUE" : "FALSE") . "<BR/>";
  11. ?>
  12. </BODY>
  13. </HTML>
This script works fine at another Linux server. But in the windows server i am using, the result is:
  1. mail() returned: TRUE
but sending no mail at all.

The server setting is like:
  1. Directive Local Value Master Value
  2. sendmail_from <a href="mailto:me@localhost.com">me@localhost.com</a> <a href="mailto:me@localhost.com">me@localhost.com</a>
  3. sendmail_path no value no value
  4. SMTP 213.200.51.11 213.200.51.11
  5. 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
Last edited by peter_budo; Jun 11th, 2008 at 3:22 pm. Reason: Keep It Organized - please use [code] tags
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 2
Reputation: MeixiuLin is an unknown quantity at this point 
Solved Threads: 0
MeixiuLin MeixiuLin is offline Offline
Newbie Poster

Re: PHP Mail function not working in Windows Server

 
0
  #2
Jun 11th, 2008
I found the solution by myself:
put
  1. <?php
  2. ini_set("sendmail_from", "info@mydomain.com");?>
at the beginng of mail testing file.....
Last edited by peter_budo; Jun 11th, 2008 at 3:22 pm. Reason: Keep It Organized - please use [code] tags
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 1
Reputation: songjockey is an unknown quantity at this point 
Solved Threads: 0
songjockey songjockey is offline Offline
Newbie Poster

Re: PHP Mail function not working in Windows Server

 
0
  #3
Aug 14th, 2009
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:

  1. <?
  2.  
  3. phpini_set("sendmail_from", "info@mydomain.com");
  4.  
  5. ?>

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.
Last edited by peter_budo; Aug 16th, 2009 at 4:55 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 6581 | Replies: 2
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2010 DaniWeb® LLC