ID: 15373 Comment by: rmsadik dot ece at gmail dot com Reported By: alonso at admintek dot net Status: No Feedback Bug Type: Mail related Operating System: win2000 PHP Version: 4.2.1 Assigned To: mfischer New Comment:
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 = "msa...@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); } Previous Comments: ------------------------------------------------------------------------ [2008-11-25 17:17:49] jeff at jouster dot org I 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("m...@address.tld", "subject", "body", "From: My Name <m...@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 = m...@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. ------------------------------------------------------------------------ [2008-07-10 15:47:04] phpseven at yahoo dot com smtp server can't run. i tried my best to solve it but it can't send the mail. ------------------------------------------------------------------------ [2007-10-25 11:13:44] vvel3000 at yahoo dot co dot in Warning: mail() [function.mail]: Failed to connect to mailserver at "mail.yourisp.com" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\1.php on line 7 There was an error why so you error ------------------------------------------------------------------------ [2007-09-17 18:06:22] johan dot jv at gmail dot com Hello guys, I see that you are having a lot of problem in sending email and some of you might not even been receiving any emails. Couple of things that you might need to check before sending any emails. 1- Anti-virus (make sure that the antivirus is not blocking port 25) 2- Your firewall, make sure that your fire wall are not blocking port 25, also make sure that you have your SMTP anable to receive email, you can set that up in your Firewall - Start - Settings- Network Connections - Advanced tab - Setting - exceptions "if you SMTP is not there, click Add Port , on the name field you can write (SMTP TCP) and under port type 25, then hit ok. do that again but with the same port and name but with UDP. 3 - REALLY IMPORTANT. if you are behind a router , you ISP might blocked 25 or you might just need to forward port 25 from your router seetings "portforward dot com/" 4- If you want to know if your port 25 is open or available go to this website canyouseeme dot org and on the field type 25 that will tell you if your port is active. ------- Something else you might try. -==if you don't know if your SMTP is working or install, Click Start - Setting - Control panel - add & Remove program - on the left side click Add / Remove Window Components - under the Windows Components Wizard you can see Internet Information Services (IIS) Click that and then Click DETAIL (it's on the right side) after that you can see a list of the IIS Server, Click or Check the SMTP Server __""""Window might ask you for Window XP or your OS CD to install does files"""" make sure you have that on hand if you want to do this step. Then say okay. Restart your Apache server or you IIS server if you have one, then try to send your email again..... It might work.....doesn't hurt to try. :) Good Luck ------------------------------------------------------------------------ [2007-07-08 16:50:50] kivin_kong at hotmail dot com i have windows server 2003 R2 with IIS and php 5.2.3 and the mail() function ain't working the i use my ISP DNS server and not workin don't know what to do can someone help it is a recruitment form trying to send it to my email kivin_k...@hotmail.com ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/15373 -- Edit this bug report at http://bugs.php.net/?id=15373&edit=1