Page 1 of 1
mail command not working...
Posted: Fri Jun 03, 2005 7:58 pm
by danf_1979
Should this code work??? I got no mail in my yahoo account
Code: Select all
<?php
$message = "hola qliao";
$user_email = "danf_1979@yahoo.es";
$subject = "prueba";
$from = "yo mismo";
mail($user_email, $subject, $message, "From: $from\nX-Mailer: PHP/" . phpversion());
echo "email sent";
?>
Posted: Fri Jun 03, 2005 8:50 pm
by ol4pr0
try ::
Code: Select all
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: MYSELFANDI <your@email.com>\r\n";
$headers .= "X-Sender: your@email.com\r\n";
$headers .= "X-Mailer: PHP\r\n";
$headers .= "X-Priority: 1\r\n";
$headers .= "Return-Path: your@email.com\r\n";
$subject = "My test mail";
$message ="<html><body>You got Mail</body></html>";
mail("your@email.com", $subject, $message, $headers);
Posted: Fri Jun 03, 2005 9:06 pm
by danf_1979
It didnt work. How can I know if my web hosting company has mail function disabled or something?? I cant call know because is too late (night)
Posted: Fri Jun 03, 2005 9:11 pm
by danf_1979
I saw a message in cpanel in my hosting provider. It says i should make sure SMTP is activated... does this make sense? I dont know how to configure SMTP to send mail in php
Posted: Sat Jun 04, 2005 2:07 pm
by ol4pr0
Meaning that you should login into your Cpanel and check if you have set your SMTP settings.
However if your hosting provider has any good service at all they wouldnt mind sending you a explaination on how to do that.
SMTP = Simple Mail Transfer Protocol ( Sending Mail )
POP3 = Post Office Protocol ( Receiving Mail )
To check if PHP Executed the command mail; [ example ]
Code: Select all
$email = "your@mail.com";
$ok = mail($email, $subject, $message, $headers);
if ($ok) {
echo "Mail succesfully Send to: ".$email;
} else {
echo "Error: Unable to send mail to: ".$email;
}