Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'PHPMailerAutoload.php';
- $mail = new PHPMailer;
- //$mail->SMTPDebug = 3; // Enable verbose debug output
- $mail->isSMTP(); // Set mailer to use SMTP
- $mail->Host = 'smtp1.example.com'; // Specify main and backup SMTP servers
- $mail->SMTPAuth = true; // Enable SMTP authentication
- $mail->Username = 'user@example.com'; // SMTP username
- $mail->Password = 'secret'; // SMTP password
- $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
- $mail->Port = 587; // TCP port to connect to
- $nombre = $_POST['nombre'];
- $mail = $_POST['email'];
- $telefono = $_POST['telefono'];
- $asunto = $_POST['asunto'];
- $empresa = $_POST['mensaje'];
- $mail->setFrom($nombre, $mail);
- $mail->isHTML(true); // Set email format to HTML
- $asunto = 'Mensaje de mi sitio web';
- $mensaje = "Este mensaje fue enviado por " . $nombre . ",\r\n";
- $mensaje .= "Su e-mail es: " . $mail . " \r\n";
- $mensaje .= "Asunto: " . $asunto . " \r\n";
- $mensaje .= "Teléfono: " . $telefono . " \r\n";
- $mensaje .= "Mensaje: " . $_POST['mensaje'] . " \r\n";
- $mensaje .= "Enviado el " . date('d/m/Y', time());
- $mail->Subject = $asunto;
- $mail->Body = $mensaje;
- if(!$mail->send()) {
- echo 'Message could not be sent.';
- echo 'Mailer Error: ' . $mail->ErrorInfo;
- } else {
- echo "<script type='text/javascript'>alert('Tu mensaje ha sido enviado exitosamente');</script>";
- echo "<script type='text/javascript'>window.location.href='http://www.agroeducacion.com/postgrado';</script>";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement