Tuesday 25 September 2018

email - Mail function is not working in PHP

mail($to, "Subject: $subject",$message );
echo "Thank you for using our mail form";

instead of this ,first check if the mail is sent


$mail=mail($to, "Subject: $subject",$message );
if($mail){
echo "Thank you for using our mail form";
}else{
echo "Mail sending failed.";
}

By this actually u can know whether your mail function in working or not


if it is not working.the problem can be with SMTP settings in your localhost


enable errors in php if not enabled using


ini_set('display_errors',1);

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...