Page 1 of 1

MAIL SYSTEM DONT WORK

Posted: Fri Nov 12, 2010 5:45 am
by jopet00222
when i click send it says:
mail send.

but no email sent in my enail "popoliker@yahoo.com.ph"


LOGIN.PHP

Code: Select all

<html>
<head>
<title>Script to send mail</title>
</head>
<body>
<?php
$to = "popoliker@yahoo.com.ph";
$subject = "Test mail";
$message = "$name,$password";
$from = "popoliker1@yahoo.com.ph";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>
</body>
</html>

INDEX.HTML

Code: Select all

<html>
<head>
<title>E-mail Form</title>
</head>
<body>
<form action="login.php" method="POST">
<p>name:<br /> <input type="text" size="20" name="name" /></p>
<p>password:<br /> <input type="text" size="20" name="password" /></p>
<p><input type="submit" value="send" /></p>
</form>
</body>
</html>
 

Re: MAIL SYSTEM DONT WORK

Posted: Fri Nov 12, 2010 7:36 am
by Celauran
Because of the way the script is written, it will always say "Email Sent." It doesn't actually check if the mail sent successfully, though.

Code: Select all

@mail($to, $subject, $message, $headers) or die ("Mail could not be sent: $php_errormsg");

Re: MAIL SYSTEM DONT WORK

Posted: Fri Nov 12, 2010 9:25 am
by recuerdeme
the below will actually check if the mail is sent.

Code: Select all

if (mail($to,$subject,$message,$headers)){
echo "Mail Sent.";
} else {
echo "FAIL";
}
Go into your ini file and make sure you mail is on and everything is correct.

We recently moved servers (to 64-bit) and mail() doesn't work anymore, I have to use something completely different.

Re: MAIL SYSTEM DONT WORK

Posted: Sat Nov 13, 2010 12:36 am
by jopet00222
i mean it is always failed sending

please help


i am a newbie to PHP

Re: MAIL SYSTEM DONT WORK

Posted: Sat Nov 13, 2010 2:15 am
by cpetercarter
mail() will work only if there is a mail transfer agent like Sendmail on your server. Ask your web hosting company or system admin whether you can send e-mails from your server.