<?php
require('PHPMailer_5.2.2/class.phpmailer.php');
class.phpmailer.php if not already loaded
$mail = new PHPMailer();
$body = "Detalles del formulario de contacto: <br>";
$body .= "Nombre: " . $_POST['your-name'] . "<br>";
$body .= "Apellido: " . $_POST['Apellidos'] . "<br>";
$body .= "E-mail: " . $_POST['your-email'] . "<br>";
$body .= "Teléfono: " . $_POST['telefono'] . "<br>";
$body .= "Skype: " . $_POST['text-360'] . "<br>";
$body .= "Edad: " . $_POST['number-837'] . "<br>";
$body .= "Asunto: ". $_POST['your-subject']. "<br>";
$body .= "Motivo Consulta: " . $_POST['your-message'] . "<br><br>";
$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Host = "mihost.com"; // sets the SMTP server
$mail->Port = 25; // set the SMTP port for the GMAIL server
$mail->Username = "midireccionemail"; // SMTP account username
$mail->Password = "password"; // SMTP account password
$mail->Subject = "Consulta online";
$mail->MsgHTML($body);
$numero=$_POST['checkbox-906'];
$count = count($numero);
for ($i = 0; $i < $count; $i++) {
if ($numero[$i]==1){
$mail->AddAddress("
[email protected]", "direccion1");
}
if ($numero[$i]==2){
$mail->AddAddress("
[email protected]", "direccion2");
}
if ($numero[$i]==3){
$mail->AddAddress("
[email protected]", "direccion3");
}
}
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
header ("location:http://.../gracias-por-tu-mensaje/" ) ;
die();
}
?>