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      = '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
Link to comment
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]
Link to comment
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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.