email - PHP Contact Form for Bootstrap -
this question has answer here:
i have trouble php contact form on bootstrap. don't know problem. gives error message. replaced e-mail address there still gives error. don't know line change.
<?php // check empty fields if(empty($_post['name']) || empty($_post['email']) || empty($_post['phone']) || empty($_post['message']) || !filter_var($_post['email'],filter_validate_email)) { echo "no arguments provided!"; return false; } $name = $_post['name']; $email_address = $_post['email']; $phone = $_post['phone']; $message = $_post['message']; // create email , send message $to = 'info@balkescafequiz.com'; // add email address inbetween '' replacing yourname@yourdomain.com - form send message to. $email_subject = "website contact form: $name"; $email_body = "you have received new message website contact form.\n\n"."here details:\n\nname: $name\n\nemail: $email_address\n\nphone: $phone\n\nmessage:\n$message"; $headers = "from: noreply@balkescafequiz.com\n"; // email address generated message from. recommend using noreply@yourdomain.com. $headers .= "reply-to: $email_address"; mail($to,$email_subject,$email_body,$headers); return true; ?>
i didnt read trough script, try use this:
//clean string before sending function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } //build message $email_message .= "$l_firstname: ".clean_string($firstname)."\n"; $email_message .= "$l_lastname: ".clean_string($lastname)."\n"; $email_message .= "$l_email: ".clean_string($email)."\n"; $email_message .= "$l_phone: ".clean_string($phone)."\n"; $email_message .= "$l_msg: ".clean_string($message)."\n"; $email_subject = "new mail "."$fullname"; // create email headers $headers = 'from: '."$fullname".'<'.$email.'>'."\r\n". 'reply-to: '.$email."\r\n" . 'x-mailer: php/' . phpversion(); mail($recipient, $email_subject, $email_message, $headers); //return index, show confirmation header("location: index.php?lang=$language&show=success");
this use :)
Comments
Post a Comment