Viewing file: envia.php (1.35 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
// Varios destinatarios
$para = 'contacto@tecnocielo.cl';
//$para .= 'wez@example.com';
$nombre=$_POST['nombre'];
$mail=$_POST['mail'];
$comentario=$_POST['comentario'];
// título
$título = 'Contacto WEB';
// mensaje
$mensaje = '
<html>
<head>
<title>Contacto WEB</title>
</head>
<body>
<table>
<tr>
<td>Nombre</td><td>: '.$nombre.'</td>
</tr>
<tr>
<td>Correo</td><td>: '.$mail.'</td>
</tr>
<tr>
<td>Comentario</td><td>: '.$comentario.' </td>
</tr>
</table>
</body>
</html>
';
// Para enviar un correo HTML, debe establecerse la cabecera Content-type
$cabeceras = 'MIME-Version: 1.0' . "\r\n";
$cabeceras .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Cabeceras adicionales
//$cabeceras .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n";
$cabeceras .= 'From: '.$nombre.' <'.$para.'>' . "\r\n";
//$cabeceras .= 'Cc: birthdayarchive@example.com' . "\r\n";
//$cabeceras .= 'Bcc: birthdaycheck@example.com' . "\r\n";
// Enviarlo
if(mail($para, $título, $mensaje, $cabeceras)){
echo "<script type='text/javascript'>alert('Correo enviado correctamente');location.href='contacto.php';</script>";
}else{
echo "<script type='text/javascript'>alert('Problemas al enviar correo, intentelo nuevamente.');location.href='contacto.php';</script>";
}
|