942,782 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 19549
  • PHP RSS
Jun 11th, 2008
0

PHP Mail function not working in Windows Server

Expand Post »
I have trid the testing script as follows:
php Syntax (Toggle Plain Text)
  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:
PHP Syntax (Toggle Plain Text)
  1. mail() returned: TRUE
but sending no mail at all.

The server setting is like:
PHP Syntax (Toggle Plain Text)
  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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
MeixiuLin is offline Offline
2 posts
since Jun 2008
Jun 11th, 2008
0

Re: PHP Mail function not working in Windows Server

I found the solution by myself:
put
php Syntax (Toggle Plain Text)
  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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
MeixiuLin is offline Offline
2 posts
since Jun 2008
Aug 14th, 2009
0

Re: PHP Mail function not working in Windows Server

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:

php Syntax (Toggle Plain Text)
  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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
songjockey is offline Offline
1 posts
since Aug 2009
Jun 14th, 2011
0
Re: PHP Mail function not working in Windows Server
Guys, i love you.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
clouding.it is offline Offline
1 posts
since Jun 2011

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: print array in php when you don't know array keys
Next Thread in PHP Forum Timeline: sha1 login problem, when submitting form





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC