|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-02-04 21:00 UTC] alonso at admintek dot net
I moved a program from winnt4 php 4.0.6 to win2000 php 4.1.1 and now mail doesn't work. In fact no matter what I put in SMTP in php.ini or if the email address is correct, mail() always returns 1. Always, immediately returns 1. It never sends emails even with correct parameters and SMTP. If it at least gave an error I would know why it doesn't work. I tried 4.1.0 and is same thing. OS is win2000 fresh install with IIS5. Webserver is Apache but php.exe works the same way. Patchesphp.ini (last revision 2010-06-16 12:06 UTC by eddykuff at 37 dot com)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 12:00:01 2025 UTC |
I have finally tested with php 4.2.1 and php4-win32-latest-zip and both work the same. They do not send the email and always immediately return 1. Script: ini_set("SMTP","shouldfail"); echo mail("alonso@xxx.net","test","hola"); returns "1" Using a correct SMTP also returns "1" and doesn't send the email. I have found no way of sending the email except installing php 4.0.6 which does work. You said "Error reporting has been improved", how do I use this improved error reporting?mfischer, I think you do not understand my situation. I have in my php.ini: SMTP = nothing-should-give-error; invalid SMTP error_reporting = E_ALL; display_errors = On ; Then I have a script with: //send mail with invalid STMP to invalid address echo mail("noaddress","test","hola"); It immediately returns "1". Even with invalid SMTP and invalid email it just says "1" no errors are reported. Then how am I supposed to test my SMTP server if mail() always returns 1 and never sends the email? If I use a correct SMTP and correct address it does the same thing. I need to make it give some kind of error. Again, if I use php4ts.dll and php4apache.dll from php4.0.6 it says "Bad Message destination" or "Failed to Connect" if I put a valid address and keep the invalid SMTP. With valid address and SMTP the email is sent correctly with 4.0.6.OS Windows XP home Editio Server Apache 1.3.28 PHP 4.3.3 I tried doing this: <?PHP ini_set('smtp_port','25'); mail("doug32x@hotmail.com","Hi","Message") ?> I get this: Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set(). I tried by changin the php.ini and it does not work :( I hope you can help me Thanks a lotXP PRO SP2 PHP 5.1.6 This is the error Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in D:\www\htdocs\sendmail.php on line 43 this is line 43 of my php mail script mail("address@dodo.com.au", $subject, $message, $from); This is my PHP.INI [mail function] ; For Win32 only. SMTP = smtp.dodo.com.au ; For Win32 only. sendmail_from = comment@mywebsite.comI have this same problem. I have Windows Server 2003 SP2 IIS 6. PHP6-dev (also same problem with 5.4) Port 25 is open and I can telnet to the server from my home machine completely outside the network and manually send an email. So I know that SMTP is not the problem and relaying is not a problem. Here's my script: <?php $success = mail("my@address.tld", "subject", "body", "From: My Name <my@address.tld>"); echo ($success); if ($success) { echo (" success!"); } else { echo (" problem..."); } ?> When I run this test script I see: 1 success! However I never get an email. I have php.ini set to log errors (have also tried display errors) and there is never any errors logged or displayed. php.ini SMTP section: [mail function] ; For Win32 only. SMTP = localhost smtp_port = 25 ; For Win32 only. sendmail_from = my@address.tld phpinfo() shows all of this information properly (only after I moved the .ini file into the PHP install directory. I have PHPRC environment variable set to PHP install directory and have added same directory to my PATH env var. Mail was successfully being sent until another issue caused me to uninstall and reinstall the SMTP Service portion of IIS. I see no solutions or cause to this problem in this thread. Any new news? Original issue was posted 6 years ago... I can't believe this is still cropping up for people.i have problem sending email using mail(). it was working couple of weeks before but now on its not working ...i dont know whats the problem and here is the code if ($db_result) { echo "Successful"; $to = $email; $from = "msathh@gmail.com"; $subject = "Password Request From"; $message = "PLEASE DO NOT REPLY TO THIS EMAIL\n\n"; $message .= "unless others can read your email.\n\n\n"; $message .= "Password: ".$password; $headers = "From: ".$from; // Set the name of the server for mail processing. This should be handled at the server level but the following // statement allows dynamic setting of the SMPT server for testing purposes. ini_set("SMTP","mail.sunet.com.au"); // Attempt to send the mail message. //$db_result = mail($to,$subject,$message,$headers); mail($to,$subject,$message,$headers); }Am php to send E-mail,but will be Error. Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in -----code---- Contact.html ----------- <html> <head> <meta http-equiv="Content-Type" content="text/html;>charset=iso-8859-1" /> <title>Cultuzz Digital Media GmbH - Contact</title> </head> <center> <body bgcolor="FF9900"> <div class="componentheading"><h1>Contact Us</h1></div> <table width="50%" cellpadding="0" cellspacing="0" border="0" class="contentpane"> <!-- <form action="../Contactus/Contact1.php" method="post"> --> <form action="../Contactus/Mailto.php" method="post"> <table> <!-- <body background="FF9900"> --> <tr> <td align="right" class="w"><b>Enter your To Address:</b></font></h3></td> <td><input type="text" name="toAddr" size="25"></td> </tr> <tr> <td align="right" class="w"><b>E-mail your From Address:</b></font></td> <td><input type="text" name="fromAddr" size="25"></td> </tr> <tr> <td align="right" class="w"><b>Enter your Password:</b></font></td> <td><input type="password" name="toPass" size="25"></td> </tr> <tr> <td align="right" class="w"><b>Enter your Subject:</b></font></td> <td> <input type = "text" name="subject" size="25"> </td> </tr> <tr> <td align="right" class="w"><b>Enter your Content:</b></font></td> <td> <textarea name="content" size="20" cols="25" rows="7"></textarea> </td> </tr> <tr> <td> <center> <input type="submit" name="submit" value="Submit"> </center> </td>                                       </tr> </body> </table> </form> </body> </center> </html> <!-- <textarea name="content" size="20" cols="25" rows="7" value="<?php echo $_POST['content']; ?>"></textarea> --> --------------------- mailto.php ---------------------- <!-- Mail to multiple recipients --> <?php /*$headers = "From:sender@java2s.com\r\n"; $recipients = "test@java.com,a@java2s.com"; mail($recipients, "This is the subject","This is the mail body", $headers); */ /* $SMTP = 10.200.10.7 $smtp_port = 25*/ $toAddr = "toAddr"; $fromAddr = "fromAddr"; $toPass = "toPass"; $subject = "subject"; $content = "content"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: sk.ganehan@yahoo.co.in\r\n' . 'Reply-To: real_ganesh@yahoo.co.in\r\n'; //u can add //$headers .= 'CC : test@test.com\r\n'; //$headers .= 'BCC : test@test.com\r\n'; mail($toAddr, $fromAddr, $toPass, $subject,$content); echo "This is To---------------->: $toAddr <br/>"; echo "This is From----------->: $fromAddr <br/></n>"; echo "This is Password----------->: $toPass <br/>"; echo "This is Subject----------->: $subject <br/></n>"; echo "This is Content----------->: $content <br/></n>"; echo "This is Headers----------->: $headers <br/></n>"; ?>Hi, I am also having the same problem with this. I am using Mac OS X, and it doesn't seem to be sending. Script: <?php if(!mail($_POST['email'],"blabla","$text_body")){ echo("Unable to send verification email."); }else{ echo("Sent verification email."); } ?> Mail seems to always return true.i am having a problem like this and am so lost, i cant send mail from the server but it wont let mail be sent from the website and they tell me it is a problem with the PHP can some look and tell me what i have dont wrong and how to make it work. <?php //-------------------------------------------------------------------- User Area $ToEmail = "mail.thirdstreetdesignstudio.com"; $ToName = "Dallas Thompson"; $ToSubject = "Thanks for your email. One of our consultants will respond to your request shortly.?"; //-------------------------------------------------------------------- //-------------------------------------------------------------------- Prohibited Area No Changes $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: '.$_POST['_namex'].' <'.$_POST['_emailx'].'>' . "\r\n"; $Message = "Sender Name:".$_POST['_namex']."<br/><br/>Sender Email:".$_POST['_emailx']."<br/><br/>Sender Phone:".$_POST['_phonex']."<br/><br/>Message:".$_POST['_commx']; if($_REQUEST['_emailx']!=""){ mail($ToName." <".$ToEmail.">",$ToSubject, $Message, $headers); } echo "_root.Status=success"; ?>