require_once("include/phpmailer/class.phpmailer.php");
if (isset($_POST['send_f'])) {
$mail = new PHPMailer();
$mail->Host = "localhost";
$mail->From = $_POST['correo'];
$mail->FromName = "Web Site Tractomaquinas";
$mail->Subject = sprintf("Contacto: %s", $_POST['name']);
$mail->AddAddress("ventas@tractomaquinas.com, tractomaquinas@hotmail.com");
$body = "Details
";
if (is_uploaded_file($HTTP_POST_FILES['file']['tmp_name'])){
$mail->AddAttachment($HTTP_POST_FILES['file']['tmp_name'], $HTTP_POST_FILES['file']['name']);
//copy($HTTP_POST_FILES['archivo']['tmp_name'], $HTTP_POST_FILES['archivo']['name']);
$att = 1;
}
foreach($_POST as $value => $key){
if($value != 'send_f' && $value != 'Send' && $value != 'file'){
$body.= sprintf("%s: %s
", $value, ucwords($key));
}
}
$body.= sprintf("Attachment: %s
", ($att) ? 'Yes' : 'No');
$body .= "
Technical information for monitoring
";
$body .= "REQUEST: " . date("d/m/Y - h:i:s A")."
";
$body .= "IP: " . $_SERVER['REMOTE_ADDR']."
";
$body .= "PROXY: " . $_SERVER["HTTP_X_FORWARDED_FOR"]."
";
$body .= "IP CLIENT: " . $_SERVER['HTTP_CLIENT_IP']."
";
$body .= "USER AGENT: " . $_SERVER['HTTP_USER_AGENT']."
";
$body.= "
Submitted by Tractomaquinas WebSite";
$mail->Body = $body;
$mail->IsHTML(true);
$result= $mail->Send();
if($result){
$muestra="MENSAJE ENVIADO";
}else{
$muestra="OCURRIO UN ERROR AL ENVIAR MENSAJE";
}
//header("Location: index_ok.php");
}
?>
Tractomaquinas LTDA | Motores | Tractores