Hola tengo este formulario de Reservas, el cliente selecciona el tour, cantidad de personas y fecha, se hace la suma de los totales, dan enviar y me llegan los datos a mi correo (todo eso funciona perfecto).
Sin embargo no le están llegando las "Autorespuestas" a los clientes con las confirmaciones de sus reservas. Les agradezco si me ayudan a verificar porqué no llegan!!
Muchas gracias, pura vida!
Este es el link del Form http://tamcostarica.com/isb-congress/booking-form/
y este el código que procesa ese formulario:
<!DOCTYPE html>
<html lang="en">
<head>
<link href="css/style.css" media="screen" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="wrapper">
<!--<div id="header">
<img src="images/header-1.png" />
</div> -->
<div id="thanks-return">
<h2> Thank you, your message has been submitted </h2>
<p><b>Change & Cancellation Policy</b> <br><br> If you wish to change or cancel your tour reservation made online, you must contact TAM at <a href="mailto:
[email protected]">mice1@tamtravel. com</a> no later than Monday May 9th, 2016 by 3pm EST. Any changes or cancellations after this date will be charged at 100%.</p>
<br>
<a href="http://tamcostarica.com/isb-congress/booking-form/">
Click here to return to Booking Form
</a>
</div>
<!-- <div id="footer">
<center>
<div id="txt-footer">
<p>© Costa Rica TAM Travel Corporation <a href="http://www.tamcostarica.com">www.tamcostarica.com</a>
</p>
</div>
</center>
</div> -->
</div>
</body>
</html>
<?php
/** CONFIGURATION OPTIONS
* $email_address = The email address that all form submissions will be sent to
* $company_address = The destination address that will be used in the contact form */
$email_address = '
[email protected]';
$company_address = '
[email protected]';
@$pfw_ip = $_SERVER['REMOTE_ADDR'];
/** DO NOT EDIT ANYTHING BELOW THIS LINE UNLESS YOU ARE COMFORTABLE WITH PHP */
echo "<script>var companyAddress = '" . $company_address . "';</script>";
$field_rules = array(
'name' => 'required',
'email' => 'required|valid_email',
// 'persons' => 'required',
// 'contact_reason' => 'required',
// 'message' => 'required'
);
$error_messages = array(
'required' => 'This field is required',
'valid_email' => 'Please enter a valid email address'
);
$error_list = '';
$fields = $_POST;
if (!empty($fields)) {
//Validate each of the fields
foreach ($field_rules as $field => $rules) {
$rules = explode('|', $rules);
foreach ($rules as $rule) {
$result = null;
if (isset($fields[$field])) {
if (!empty($rule))
$result = $rule($fields[$field]);
if ($result === false) {
$field_name = ucwords(implode(' ', explode('_', $field)));
$error_list .= "<div class='error'>$field_name: " . $error_messages[$rule] . "</div>";
}
}
}
}
$personsGrandTotal = 0;
$toursCostGrandTotal = 0;
if (empty($error_list)) {
$subject = 'I.S.B Congress-Booking request for : ' . $fields['name'] . '.';
$content = $fields['name'] . " sent you a message from your booking form:";
$content .= " \nEmail: " . $fields['email'];
$content .= " \nHost Hotel: " . $fields['hotel'];
$content .= "\n\nTours booked and additional services:\n";
$tourList = '';
$tours = $fields['tours'];
$index = 0;
foreach ($tours as $tourName) {
if (!trim($tourName)) {
$index++;
continue;
}
$arr = explode('|', $tourName);
$nameOfTour = trim($arr[0]);
$priceOfTour = trim($arr[1]);
$numerOfPersons = $fields['persons'][$index];
$tourCost = $priceOfTour * $numerOfPersons;
$personsGrandTotal += $numerOfPersons;
$toursCostGrandTotal += $tourCost;
$tourList.= " - " . $nameOfTour . ".\n Pax: " . $numerOfPersons . ".\n Sub-Total tour cost: $" . $tourCost . "\n\n";
$index++;
}
$content .= $tourList;
if ($personsGrandTotal > 0) {
$content .= "Total Pax: " . $personsGrandTotal . "\n";
$content .= "Total Tours Cost: $" . $toursCostGrandTotal . "\n\n\n";
}
$tourList2 = '';
$tours2 = $fields['tours2'];
$index = 0;
foreach ($tours as $tourName) {
if (!trim($tourName)) {
$index++;
continue;
}
$arr = explode('|', $tourName);
$nameOfTour = trim($arr[0]);
// $priceOfTour = trim($arr[1]);
// $numerOfPersons = $fields['persons'][$index];
// $tourCost = $priceOfTour * $numerOfPersons;
// $personsGrandTotal += $numerOfPersons;
// $toursCostGrandTotal += $tourCost;
$tourList2.= " - " . $nameOfTour . ".\n";
$index++;
}
$content .= $tourList2;
// if ($personsGrandTotal > 0) {
// $content .= "Total Pax: " . $personsGrandTotal . "\n";
// $content .= "Total Tours Cost: $" . $toursCostGrandTotal . "\n";
// }
$content .= "\nAdditional comments: \n " . $fields['message'] . " \n";
if (mail($email_address, $subject, $content, "From: " . $fields['email'] . "\r\nReply-To: " .
$fields['email'] . "\r\nReturn-Path: " . $fields['email'] . "\r\n")) {
echo "<br/><p class='success'></p>";
} else {
echo 'ERROR!';
}
//echo "<pre>[\n", $content, "\n]</pre>";
}
}
function required($str, $val = false) {
if (!is_array($str)) {
$str = trim($str);
return ($str == '') ? false : true;
} else {
return (!empty($str));
}
}
function valid_email($str) {
return (!preg_match("/^(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){255,})(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){65,}@)(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22))(?:\\.(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22)))*@(?:(?:(?!.*[^.]{64,})(?:(?:(?:xn--)?[a-z0-9]+(?:-[a-z0-9]+)*\\.){1,126}){1,}(?:(?:[a-z][a-z0-9]*)|(?:(?:xn--)[a-z0-9]+))(?:-[a-z0-9]+)*)|(?:\\[(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){7})|(?:(?!(?:.*[a-f0-9][:\\]]){7,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?)))|(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){5}:)|(?:(?!(?:.*[a-f0-9]:){5,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3}:)?)))?(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))(?:\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))\\]))$/iD", $str)) ? false : true;
}
//Enviando auto respuesta.
$pfw_header = "From:
[email protected]\n"
. "Reply-To:
[email protected]\n";
$pfw_subject = "Your request has been received";
$pfw_email_to = "$email";
$pfw_message = "Thank you " . $fields['name'] . ". \n"
. "-----------------------------\n"
. "• In order to guarantee your reservation, please fill out the credit card authorization form, please click on the following link to download it http://www.tamcostarica.com/booking-demo/credit-card-authorization.pdf and send it back to TAM Travel by e-mail to
[email protected] or by fax (506) 2668-1345 . \n\n"
. "• If you requested transportation or any additional services a TAM Travel agent will get back to you soon. \n\n"
. "• If you wish to change or cancel your tour reservation made online, it can be done before Octuber 10th, 2016; otherwise, 100% of the tour price will be charged. \n"
. "-----------------------------\n"
. "We acknowledge receipt of your booking request with the following information: \n\n $tourList \n Total tours cost: $" . $toursCostGrandTotal
. "\n\n Ground Transportation: \n $tourList2 \n Additional comments: \n $message "
. " \n\n"
. "-----------------------------\n"
. "www.tamcostarica.com";
@mail($pfw_email_to, $pfw_subject, $pfw_message, $pfw_header);
//echo "<pre>[\n", $pfw_message, "\n]</pre>";