| | |
PHP Mail function not working in Windows Server
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Jun 2008
Posts: 2
Reputation:
Solved Threads: 0
I have trid the testing script as follows:
This script works fine at another Linux server. But in the windows server i am using, the result is:
but sending no mail at all.
The server setting is like:
I can't locate the problem cos I don't have access to server config...
Someone please tell me where the problem is..Thanks
php Syntax (Toggle Plain Text)
<!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>
PHP Syntax (Toggle Plain Text)
mail() returned: TRUE
The server setting is like:
PHP Syntax (Toggle Plain Text)
Directive Local Value Master Value sendmail_from <a href="mailto:me@localhost.com">me@localhost.com</a> <a href="mailto:me@localhost.com">me@localhost.com</a> sendmail_path no value no value SMTP 213.200.51.11 213.200.51.11 smtp_port 25 25
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
•
•
Join Date: Jun 2008
Posts: 2
Reputation:
Solved Threads: 0
I found the solution by myself:
put
at the beginng of mail testing file.....
put
php Syntax (Toggle Plain Text)
<?php ini_set("sendmail_from", "info@mydomain.com");?>
Last edited by peter_budo; Jun 11th, 2008 at 3:22 pm. Reason: Keep It Organized - please use [code] tags
•
•
Join Date: Aug 2009
Posts: 1
Reputation:
Solved Threads: 0
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:
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.
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)
<? 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.
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.
![]() |
Similar Threads
Other Threads in the PHP Forum
- Previous Thread: having problems with Onclick
- Next Thread: Error when returning page 2 forms on same page that submits to that page
Views: 5734 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class clean cms code countingeverycharactersfromastring cron curl database date directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla jquery limit link login loop mail match menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search select server sessions simple sms soap source space spam speed sql structure syntax system table tutorial update updates upload url validation validator variable video web xml youtube





