我做了一个php表单,但我无法想象如何让它自动回复填充的电子邮件。 我想发送一个确认信息给刚使用过我们的表单的人它,但我不知道如何使它。PHP自动回复器
这里我的代码示例。 我想发送一封自定义邮件到$ email,我该怎么做?!
我做了一些改变,但我不recive电子邮件喷射。 Maby我确实了解你,但是你能否再次检查我。
<?php
/* Set e-mail recipient */
$myemail = "[email protected]";
/* Check all form inputs using check_input function */
$subject = check_input($_POST['subject']);
$Voornaam = check_input($_POST['Voornaam'], "Vul A.U.B. uw Voornaam in.");
$Achternaam = check_input($_POST['Achternaam'], "Vul A.U.B. uw Achternaam in.");
$VoornaamKind = check_input($_POST['VoornaamKind'], "Vul A.U.B. de Voornaam van uw in.");
$AchternaamKind = check_input($_POST['AchternaamKind'], "Vul A.U.B. de Achternaam van uw in.");
$email = check_input($_POST['email'], "Vul A.U.B. uw Email adres in.");
$Leeftijd = check_input($_POST['Leeftijd'], "Vul A.U.B. de leeftijd van uw kind in.");
$Groep = check_input($_POST['Groep'], "Vul A.U.B. de basisschoolgroep van uw in.");
$Opmerking= ($_POST['Opmerking']);
/* If e-mail is not valid show error message */
if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email))
{
show_error("E-mail adres klopt niet");
}
/* Let's prepare the message for the e-mail */
$message = "Hallo!
Je contact formulier is ingevuld door:
Ouder/Verzorger
Voornaam: $Voornaam
Achternaam: $Achternaam
Kind:
Voornaam Kind: $VoornaamKind
Achternaam Kind: $AchternaamKind
E-mail: $email
Groep: $Groep
Leeftijd: $Leeftijd
Opmerking:
$Opmerking
Einde bericht.
"
;
/* Send the message using mail() function */
mail($myemail, $subject, $message);
/* Redirect visitor to the thank you page */
header('Location: bedankt.html');
exit();
/* Functions we used */
function check_input($data)
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
if (strlen($data) == 0)
{
return false;
}
else
{
return $data;
}
}
function show_error($myError)
{
?>
<html>
<body>
<b>Please correct the following error:</b><br />
<?php echo $myError; ?>
</body>
</html>
<?php
$email = 'email';
$subject = 'subject';
$message = "Hallo!
U/jij bent nu opgegeven voor Kids N Theatre met De Vliegende Speeldoos.
Dit is wat wij aan gegevens hebben gekregen:
Ouder/Verzorger
Voornaam: $Voornaam
Achternaam: $Achternaam
Kind:
Voornaam Kind: $VoornaamKind
Achternaam Kind: $AchternaamKind
E-mail: $email
Groep: $Groep
Leeftijd: $Leeftijd
Opmerking:
$Opmerking
Einde bericht.
";
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($email, $subject, $message, $headers);
?>
<?php
exit();
}
?>
检查PHP的mail()函数。 – 2014-10-11 10:40:02
在您的操作后添加php邮件()... – 2014-10-11 10:45:05
当您尝试此代码时会发生什么情况? – webeno 2014-10-11 10:45:45