<?php
require("../Connections/conexion.php");
if(isset($_POST['boton'])){ if($_POST['created_by'] == ''){
$error1 = '<span class="error">Value missing</span>';
}else if($_POST['mail'] == '' or
!preg_match("/^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$/",$_POST['mail'])){ $error2 = '<span class="error">Value missing</span>';
}else if($_POST['coments'] == ''){
$error4 = '<span class="error">Value missing</span>';
}else if($_POST['carrier'] == ''){
$error5 = '<span class="error">Value missing</span>';
}else if($_POST['dostier'] == ''){
$error6 = '<span class="error">Value missing</span>';
}else if($_POST['origin'] == ''){
$error7 = '<span class="error">Value missing</span>';
}else if($_POST['destination'] == ''){
$error8 = '<span class="error">Value missing</span>';
}else if($_POST['incident_type'] == ''){
$error9 = '<span class="error">Value missing</span>';
}else if($_POST['hour'] == ''){
$error10 = '<span class="error">Value missing</span>';
}else if($_POST['Creation_date_from'] == ''){
$error11 = '<span class="error">Value missing</span>';
}else if($_POST['delivery_date_from'] == ''){
$error12 = '<span class="error">Value missing</span>';
}else if($_POST['awb_or_pro_number'] == ''){
$error13 = '<span class="error">Value missing</span>';
}else if($_POST['rca'] == ''){
$error14 = '<span class="error">Value missing</span>';
}else if($_POST['claim'] == ''){
$error15 = '<span class="error">Value missing</span>';
}else if($_POST['Status'] == ''){
$error16 = '<span class="error">Value missing</span>';
}else if($_POST['root_cause'] == 'NULL'){
$error17 = '<span class="error">Value missing</span>';
}else if($_POST['envio'] == ''){
$error18 = '<span class="error">Value missing</span>';
}else if($_POST['envio1'] == ''){
$error20 = '<span class="error">Value missing</span>';
}else if($_POST['envio2'] == ''){
$error21 = '<span class="error">Value missing</span>';
}else if($_POST['envio3'] == ''){
$error22 = '<span class="error">Value missing</span>';
}else if($_POST['envio4'] == ''){
$error23 = '<span class="error">Value missing</span>';
}else if($_POST['envio5'] == ''){
$error24 = '<span class="error">Value missing</span>';
}else if($_POST['envio6'] == ''){
$error25 = '<span class="error">Value missing</span>';
}else if($_POST['envio7'] == ''){
$error26 = '<span class="error">Value missing</span>';
}else if($_POST['envio8'] == ''){
$error27 = '<span class="error">Value missing</span>';
}else if($_POST['envio9'] == ''){
$error28 = '<span class="error">Value missing</span>';
}else if($_POST['envio10'] == ''){
$error29 = '<span class="error">Value missing</span>';
}else if($_POST['envio11'] == ''){
$error30 = '<span class="error">Value missing</span>';
}else if($_POST['envio12'] == ''){
$error31 = '<span class="error">Value missing</span>';
}else if($_POST['envio13'] == ''){
$error32 = '<span class="error">Value missing</span>';
}else if($_POST['actionplan'] == ''){
$error19 = '<span class="error">Value missing</span>';
}else{
foreach($_POST AS $key => $value) {
}
$sql = "INSERT INTO "aqui van los datos de la tabla para insercion";
//lo inserto en la base de datos
if (mysql_query($sql,$conn)){
//recibo el último id
$id = mysql_insert_id($conn);}
mysql_query($sql) or die(mysql_error());
$dest = $_POST['envio']; //Email de destino
$dest1 = $_POST['envio1']; //Email de destino
$dest2 = $_POST['envio2']; //Email de destino
$dest3 = $_POST['envio3']; //Email de destino
$dest4 = $_POST['envio4']; //Email de destino
$dest5 = $_POST['envio5']; //Email de destino
$dest6 = $_POST['envio6']; //Email de destino
$dest7 = $_POST['envio7']; //Email de destino
$dest8 = $_POST['envio8']; //Email de destino
$dest9 = $_POST['envio9']; //Email de destino
$dest10 = $_POST['envio10']; //Email de destino
$dest11 = $_POST['envio11']; //Email de destino
$dest12 = $_POST['envio12']; //Email de destino
$dest13 = $_POST['envio13']; //Email de destino
$email = $_POST['created_by'];
$carrier= $_POST['carrier'];
$incident= $_POST['incident_type'];
$origin= $_POST['origin'];
$destination= $_POST['destination'];
$asunto = "New report DIMC #".$id; //Asunto
$cuerpo = "
The message was sent to:<table width='909' style='border:#3200E6 5px solid'>
<tbody>
</tbody>
<tbody>
</tbody>
<tbody>
<tr>
<td colspan='3' align='center'> </td>
<td width='198' rowspan='4'> </td>
<td colspan='3' rowspan='4' align='right'><img src='http://10.144.80.38/intranet/nuevo/images/LOGO_GEODIS_SIGNATURE_RVB_VERTICAL.png' width='109' height='88' alt=''/></td>
</tr>
<tr>
<td colspan='3' align='center' style='border:#3200E6 3px solid'><strong>Report DIMC</strong></td>
</tr>
<tr>
<td height='40' colspan='3' align='center'>$id</td>
</tr>
<tr>
<td colspan='3'> </td>
</tr>
<tr>
<td colspan='2'><strong>Requestor: </strong></td>
<td>$email</td>
<td> </td>
<td width='151'> </td>
<td> </td>
<td width='49'> </td>
</tr>
<tr>
<td colspan='3'> </td>
<td> </td>
<td colspan='3'> </td>
</tr>
<tr>
<td width='103' colspan='2' align='center' style='border:#3200E6 3px solid'><strong>Type of incident</strong></td>
<td width='222' align='center' style='border:#3200E6 3px solid'><strong>Origin</strong></td>
<td align='center' style='border:#3200E6 3px solid'><strong> Destination</strong></td>
<td colspan='3' align='center' style='border:#3200E6 3px solid'><strong>Carrier</strong></td>
</tr>
<tr>
<td colspan='2'> </td>
<td> </td>
<td> </td>
<td colspan='3'> </td>
</tr>
<tr>
<td colspan='2' align='center'style='border:#3200E6 1px solid' >$incident</td>
<td align='center'style='border:#3200E6 1px solid'>$origin</td>
<td align='center'style='border:#3200E6 1px solid'>$destination</td>
<td colspan='3' align='center'style='border:#3200E6 1px solid'>$carrier</td>
</tr>
<tr>
<td colspan='2'> </td>
<td> </td>
<td> </td>
<td colspan='3'> </td>
</tr>
<tr>
<td> </td>
<td colspan='5' rowspan='2' align='center' style='border:#3200E6 1px solid'>This email is informative, please do not respond to this e-mail because it is not allowed to receive message</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td height='21' colspan='2'></td>
<td colspan='2'> </td>
<td colspan='3'> </td>
</tr>
</tbody>
<tbody>
</tbody>
<tbody>
</tbody>
</table>"; //Cuerpo del mensaje
//Cabeceras del correo
$headers = "From: $nombre <$email>\r\n"; //Quien envia?
$headers .= "X-Mailer: PHP5\n";
$headers .= 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; //
include ("../phpmailer/class.phpmailer.php");
include ("../phpmailer/class.smtp.php");
$mail= new PHPMailer ();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->SMTPDebug= 1;
$mail->Host= "";
$mail->Port= ;
$mail->From= $email;
$mail->AddAddress($dest);
$mail->AddAddress($dest1);
$mail->AddAddress($dest2);
$mail->AddAddress($dest3);
$mail->AddAddress($dest4);
$mail->AddAddress($dest5);
$mail->AddAddress($dest6);
$mail->AddAddress($dest7);
$mail->AddAddress($dest8);
$mail->AddAddress($dest9);
$mail->AddAddress($dest10);
$mail->AddAddress($dest11);
$mail->AddAddress($dest12);
$mail->AddAddress($dest13);
$mail->AddCC($email);
$mail->Username= "";
$mail->Password="";
$mail->Subject= $asunto;
$mail->Body= $cuerpo;
$mail->MsgHTML($cuerpo);
if($mail->Send()){
?>