Jump to content

Archived

This topic is now archived and is closed to further replies.

franck

I get this understandable ERROR ....

Recommended Posts

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 163
Mail 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

Share this post


Link to post
Share on other sites
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 163
Mail NOT Sent[/color]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.