franck Posted September 9, 2006 Share Posted September 9, 2006 what's going on?? i have the next problem:I get this error when i try the function MAIL of PHP in localhost[color=red]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:\Mis Documentos\page.php on line 163Mail NOT Sent[/color]But when i tested in my website I get the message[color=red]"Mail Sent"[/color] but I don't receive anything in mail mail box or even junk mail box ... what is the problem???This is the code: [color=green] $to = 'mypersonalmail@hotmail.com'; $subject = 'busqueda de dominio'; $message = 'buscaron: '.$what.' en la web de serv'; $headers = 'From: othermail@hotmail.com' . "\r\n" . 'Reply-To: postnip@hotmail.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); if (mail($to, $subject, $message, $headers)) { echo 'Mail Sent'; } else { echo 'Mail NOT Sent'; }[/color]Please help me out I've been sitting around for 3 hours with this problem ... I have other email scripts and they all work fine ... so what's wrong with this one??Thanks ... later guys Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 9, 2006 Share Posted September 9, 2006 this is a php.ini problam you have to setup the mail correctly ok. Quote Link to comment Share on other sites More sharing options...
franck Posted September 9, 2006 Author Share Posted September 9, 2006 Nope ... php.ini is alright because this works fine[color=red] $headers = 'From: <' . $HTTP_POST_VARS["email"] . '>'; $body = "Formulario enviado\n"; $body .= "Nombre: " . $HTTP_POST_VARS["nombre"] . "\n"; $body .= "Email: " . $HTTP_POST_VARS["email"] . "\n"; $body .= "Consulta: " . $HTTP_POST_VARS["coment"] . "\n"; mail("info@mysite.com","Consulta",$body,$headers);[/color]But this doesn't work even thought i get the [color=orange]"Mail SENT"[/color] message[color=red]$to = 'mypersonalmail@hotmail.com'; $subject = 'busqueda de dominio'; $message = 'buscaron: '.$what.' en la web de serv'; $headers = 'From: othermail@hotmail.com' . "\r\n" . 'Reply-To: postnip@hotmail.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); if (mail($to, $subject, $message, $headers)) { echo 'Mail Sent'; } else { echo 'Mail NOT Sent'; }[/color]So there is nothing else to configured i guess.by the way I'm still getting this error message when i try this localhost:[color=red]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:\Mis Documentos\page.php on line 163Mail NOT Sent[/color] Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted September 9, 2006 Share Posted September 9, 2006 This is what the manual says about the return status from the mail() function:[quote] Returns [b]TRUE[/b] if the mail was successfully accepted for delivery, [b]FALSE[/b] otherwise.It is important to note that just because the mail was accepted for delivery, it does [b]NOT[/b] mean the mail will actually reach the intended destination.[/quote]I assume you're getting the warning when your localhost is a window's machine. You need to set the SMTP parameters in the local PHP.INI file correctly. See http://www.php.net/manual/en/ref.mail.php for more information.Ken Quote Link to comment Share on other sites More sharing options...
franck Posted September 16, 2006 Author Share Posted September 16, 2006 Thanks for all the help!!Now I'm through a long period of exams and i have to leave this project for the moment ... I hope you guys are still around, I might need a hand with the consults.Thank again. :D Quote Link to comment Share on other sites More sharing options...
markbett Posted September 16, 2006 Share Posted September 16, 2006 check your mail server logs to see what happened to your email Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.