Jump to content


Photo

I get this understandable ERROR ....


  • Please log in to reply
5 replies to this topic

#1 franck

franck
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 09 September 2006 - 05:35 AM

what's going on?? i have the next problem:

I get this error when i try the function MAIL of PHP in localhost

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


But when i tested in my website I get the message
"Mail Sent" but I don't receive anything in mail mail box or even junk mail box ... what is the problem???

This is the code:

$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';
}


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

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 09 September 2006 - 06:37 AM

this is a php.ini problam you have to setup the mail correctly ok.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 franck

franck
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 09 September 2006 - 02:56 PM

Nope ... php.ini is alright because this works fine

    $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);


But this doesn't work even thought i get the "Mail SENT" message

$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';
      }


So there is nothing else to configured i guess.

by the way I'm still getting this error message when i try this localhost:

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


#4 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 09 September 2006 - 03:14 PM

This is what the manual says about the return status from the mail() function:

Returns TRUE if the mail was successfully accepted for delivery, FALSE otherwise.

It is important to note that just because the mail was accepted for delivery, it does NOT mean the mail will actually reach the intended destination.


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/m...en/ref.mail.php for more information.

Ken

#5 franck

franck
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 16 September 2006 - 04:12 AM

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

#6 markbett

markbett
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts

Posted 16 September 2006 - 04:33 AM

check your mail server logs to see what happened to your email




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users