나는 내 요구 사항을 충족시키기 위해 수정 한 스크립트를 가지고 있지만 이제는 둘 이상의 사람에게 전자 메일을 보내야합니다. 누군가 내가 올바른 방향으로 나를 가리킬 수 있었습니까? 둘 이상의 사람에게 보내도록 스크립트를 수정하십시오. 선의두 번째 전자 메일 주소를 스크립트에 추가하십시오.
<?php
if(isset($_POST['email'])) {
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "[email protected]";
$email_subject = "Kro Catering Website Enquiry";
function died($error) {
// your error code can go here
echo "We are very sorry, but there were error(s) found with the form you submitted. ";
echo "These errors appear below.<br /><br />";
echo $error."<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
die();
}
// validation expected data exists
if(!isset($_POST['your_name']) ||
!isset($_POST['type']) ||
!isset($_POST['guests']) ||
!isset($_POST['date']) ||
!isset($_POST['phone']) ||
!isset($_POST['email'])) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$your_name = $_POST['your_name']; // required
$type = $_POST['type']; // required
$guests = $_POST['guests']; // required
$date = $_POST['date']; // not required
$phone = $_POST['phone']; // required
$email_from = $_POST['email']; // required
$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 .= "Your Name: ".clean_string($your_name)."\n";
$email_message .= "Type: ".clean_string($type)."\n";
$email_message .= "Guests: ".clean_string($guests)."\n";
$email_message .= "Date: ".clean_string($date)."\n";
$email_message .= "Phone: ".clean_string($phone)."\n";
$email_message .= "Email: ".clean_string($email_from)."\n";
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>
<!-- include your own success html here -->
<?php
header('Location: /thanks.aspx') ;
?>
<?php
}
?>
실제 문서를 찾기 위해 여분의 시간을 들여 다시 한번 화상을 입었습니다. – jedwards