目前我有下面的代码,它将html输入字段(电子邮件)的内容发送到welcome@domain.com地址。我现在正在努力解决两件事。我使用了以下代码无济于事-
$to = "welcome@domain.com";
$headers = "From: $email_from \r\n";
$headers .= "Reply-To: $visitor_email \r\n";
mail($to,$email_subject,$email_body,$headers);
//done. redirect to thank-you page.
header('Location: thankyou.html');
如何自动从welcome@domain.com 发送电子邮件回复?
而不是页面上写着“感谢您与我们联系,我们将很快与我们联系”,有没有办法将它们重定向到 domain.com/thankyou.html?
这是似乎工作正常的其余代码!如果对此有任何建议,尽管他们总是非常受欢迎!
if(isset($_POST['email'])) {
$email_to = "welcome@domain.com";
$email_subject = "Your spot has been saved!";
function died($error) {
echo "We are very sorry, but there were error(s) found with the form your submitted";
echo "These errors appear below<br /><br />";
echo $error."<br /><br />";
echo "Please go back and fix these errors<br /><br />";
die();
}
if(
!isset($_POST['email'])
) {
died("We are sorry, but there appears to be a problem with the form your submitted!");
}
$email_from = $_POST['email'];
$error_message = "";
$email_exp = "^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$";
if(!eregi($email_exp,$email_from)) {
$error_message .= "The Email Address you entered does not appear to be valid!<br />";
}
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = "Form details below.\n\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= 'Email: '.clean_string($email_from)."\n";
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>
Thank you for contacting us. We will be in touch with you very soon.
<?
}
?>