Jump to content

I get this understandable ERROR ....


franck

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      = '[email protected]';
$subject    = 'busqueda de dominio';
$message  = 'buscaron: '.$what.' en la web de serv';
$headers = 'From: [email protected]' . "\r\n" .
  'Reply-To: [email protected]' . "\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
Link to comment
https://forums.phpfreaks.com/topic/20203-i-get-this-understandable-error/
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("[email protected]","Consulta",$body,$headers);[/color]

But this doesn't work even thought i get the [color=orange]"Mail SENT"[/color] message

[color=red]$to      = '[email protected]';
      $subject    = 'busqueda de dominio';
      $message  = 'buscaron: '.$what.' en la web de serv';
      $headers = 'From: [email protected]' . "\r\n" .
        'Reply-To: [email protected]' . "\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]
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

Archived

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

×
×
  • Create New...

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.