'Nombre', 'email' => 'E-mail', 'Consulta' => 'Consulta');
foreach ($aObligatorios as $sKey => $sObligatorio) {
if (empty($_POST[$sKey]) || !isset($_POST[$sKey])) {
$aErrores[$sKey] = $sObligatorio;
}
}
if ($_POST['chkNews'] && ($_POST['categoria'] == -1 || !isset($_POST['categoria']))) {
$aErrores['categoria'] = 'Subcategoría de newsletter';
}
if (!$aErrores['email']) {
if (!validateEmail($_POST['email'])) {
$aErrores['email'] = 'Ingrese una direccion de correo valida';
}
}
switch ($_POST['area']) {
case 'consultas':
$destinatario = "consultas@pintureriasrex.com";
break;
case 'sugerencias':
$destinatario = "sugerencias@pintureriasrex.com";
break;
case 'asesoramiento':
$destinatario = "asesora@pintureriasrex.com";
break;
default:
$aErrores['area'] = 'Debe seleccionar el area';
break;
}
foreach ($_POST as $sKey => $sValue) {
$_POST[$sKey] = strip_tags($sValue);
}
$nombre = $_POST['nombre'];
$email = $_POST['email'];
$telefono = $_POST['telefono'];
$asunto = $_POST['asunto'];
$Consulta = $_POST['Consulta'];
$categoria = strtoupper($_POST['categ_final']);
if ($_POST['tipo_categ']==0) $tipo_categoria='PARTICULAR ';
else if ($_POST['tipo_categ']==1) $tipo_categoria='EMPRESA ';
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-Type: text/html; charset=\"iso-8859-1\"\n";
$headers .= "X-Priority: 1 (Higest)\n";
$headers .= "X-MSMail-Priority: High\n";
$headers .= "Importance: High\n";
$headers .= "From: $email <$email>\n";
$message = "
Formulario de contacto
Formulario enviado desde la Web
Formulario de contacto
Nombre: " . $nombre . "
Email: " . $email . "
Teléfono: " . $telefono . "
Asunto: " . $asunto . "
Mensaje: " . $Consulta . "
";
$message = utf8_decode($message);
if (!sizeof($aErrores)) {
include 'include/add-suscriptor.php';
if (@mail($destinatario, 'Contacto desde sitio web', $message, $headers)) {
header('location: http://' . $_SERVER['HTTP_HOST'] . '/form_contacto_ok.html');
exit;
} else {
$sErrores = 'Su consulta no pudo ser enviada. Intentelo de nuevo por favor.';
}
} else {
$sErrores = 'Debe completar los siguientes campos:\n\t';
$sErrores .= implode('\n\t', $aErrores);
}
}
?>
:: Pinturerias Rex :: Empresas. Contacto