Bunun için yardıma ihtiyacım var. Daha önce hiç kullanmadım.
Ek Olarak: Html template ile birlikte gelen reservation.php aşağıdaki şekilde.
Bunu smtp ile mail gönderecek şekilde nasıl düzenleyebilirim?
$email_admin = 'booking@askinartotel.com'; // Put your email here.
$enable_captcha = 'no'; // Put 'yes' if you want to enable captchas on the reservation forms.
$message_ar = 'yes'; // Put 'no' for no acknowledgement of receipt message.
$subject = 'Request for a reservation';
$output_error = '';
$message = '';
$name = '';
$email = '';
$tel = '';
$n_adults = 0;
$n_children = 0;
$type_room = '';
$check_in_date = '';
$check_out_date = '';
$message_reservation = '';
$captcha = '';
$li_name = '';
$li_message_reservation = '';
function is_valid_email_address($email){
$qtext = '[^\\x0d\\x22\\x5c\\x80-\\xff]';
$dtext = '[^\\x0d\\x5b-\\x5d\\x80-\\xff]';
$atom = '[^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c'.
'\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+';
$quoted_pair = '\\x5c[\\x00-\\x7f]';
$domain_literal = "\\x5b($dtext|$quoted_pair)*\\x5d";
$quoted_string = "\\x22($qtext|$quoted_pair)*\\x22";
$domain_ref = $atom;
$sub_domain = "($domain_ref|$domain_literal)";
$word = "($atom|$quoted_string)";
$domain = "$sub_domain(\\x2e$sub_domain)*";
$local_part = "$word(\\x2e$word)*";
$addr_spec = "$local_part\\x40$domain";
return preg_match("!^$addr_spec$!", $email) ? 1 : 0;
}
if (isset($_POST['input-name'])) {
$name = stripslashes(strip_tags($_POST['input-name']));
}
if (isset($_POST['input-e-mail'])) {
$email = stripslashes(strip_tags($_POST['input-e-mail']));
}
if (isset($_POST['select-n-adults'])) {
$n_adults = stripslashes(strip_tags($_POST['select-n-adults']));
}
if (isset($_POST['select-n-children'])) {
$n_children = stripslashes(strip_tags($_POST['select-n-children']));
}
if (isset($_POST['select-type-of-room'])) {
$type_room = stripslashes(strip_tags($_POST['select-type-of-room']));
}
if (isset($_POST['input-check-in-date'])) {
$check_in_date = stripslashes(strip_tags($_POST['input-check-in-date']));
}
if (isset($_POST['input-check-out-date'])) {
$check_out_date = stripslashes(strip_tags($_POST['input-check-out-date']));
}
if (isset($_POST['textarea-reservation'])) {
$message_reservation = stripslashes(strip_tags($_POST['textarea-reservation']));
}
if (isset($_POST['input-captcha'])) {
$captcha = stripslashes(strip_tags($_POST['input-captcha']));
}
if ($name != '') {
$li_name = "Name: $name ";
}
if ($message_reservation != '') {
$li_message_reservation = "Message: $message_reservation ";
}
$message =
"
$li_name
- E-mail: $email
- Number of adults: $n_adults
- Number of children: $n_children
- Type of room: $type_room
- Check-in date: $check_in_date
- Check-out date: $check_out_date
$li_message_reservation
";
if ($message_ar == 'yes') {
$message_ar = "Rezervasyonunuz için teşekkür ederiz. Thank you for your request for a reservation.
Here are the details you have just submitted:
$message
We will see if we have something which suits your needs and come back to you shortly.
See you soon!
";
}
$message_admin = "This is a request for a reservation:$message";
$captcha_ok = true;
if ($enable_captcha == 'yes') {
session_start();
if(($_SESSION['security_code'] == $captcha) && (!empty($_SESSION['security_code'])) ) {
unset($_SESSION['security_code']);
} else {
$captcha_ok = false;
}
}
if (!$captcha_ok) {
$output_error = 'Error: you didn\'t enter the code correctly.';
} else if (strlen(trim($_POST['input-e-mail'])) > 0) {
if (is_valid_email_address($email)) {
if ($message_ar != '') {
$headers = 'From: ' . $email_admin . "\r\n" . 'Reply-To: ' . $email_admin . "\r\n" . 'Content-Type: text/html; charset="utf-8"' . "\r\n";
if (!mail($email, $subject, $message_ar, $headers)) {
$output_error = 'Error sending acknowledgement of receipt mail.
';
}
}
$headers = 'From: ' . $email . "\r\n" . 'Reply-To: ' . $email . "\r\n" . 'Content-Type: text/html; charset="utf-8"' . "\r\n";
if (!mail($email_admin, $subject, $message_admin, $headers)) {
$output_error .= 'Error sending admin mail.';
}
} else {
$output_error = 'Error: your e-mail is not valid.';
}
} else {
$output_error = 'Error: no mail.';
}
if ($output_error == '') {
echo("Thank you for your request for a reservation.
Here are the details you have just submitted:
$message
We have sent you an e-mail with those details.
We will see if we have something to suit your needs and will come back to you shortly.
See you soon!
");
} else {
echo('' . $output_error . '');
}
?>