<?php

function limpiar($string ){
 $string = preg_replace('(\<(/?[^\>]+)\>)', '', $string);
 return $string;
}


$adminemail = "programmer1@leadmeagency.com";
$ccp1 = "";
$cco = "";


	$name = limpiar($_POST['name']);
	$mail = $_POST['mail'];
	$phone = limpiar($_POST['phone']);
	$message	=	limpiar($_POST['message']);


/*echo $nombre;
echo $mail;
echo $tel;
echo $mje;*/






$mail_caract = "/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/";




	if($name=="" || $mail=="" || $phone=="" || $message=="" )
	{
		echo 1;
	}
	elseif(!preg_match($mail_caract, $mail)){


		echo 2;

	}else{



									$headers .= "X-Sender: ".$adminemail."\n";

									$headers .= "X-Priority: 1\n";

									$headers .='x-mailer: php/' . phpversion() . "\r\n";

									$headers .= "X-Mailer: PHP - grupo camic\n";

									$headers = "MIME-Version: 1.0\r\n" ;

									  $headers .= "Content-Type: text/html; charset=utf-8\n"; // Mime type

									$headers .= "From: ".$mail."\nReply-To:".$mail."\n";



									$tema= "Te han contactado desde landing de google contable." ;

									$mensaje="
									<table width='50%' border='0' align='center' >
									  <tbody>
										<tr>
										  <td style='font-weight:600; color: #000; text-align: left; font-size:14px;'>Nombre: <span style='color: #000'>".$name."</span></td>
										</tr>
										<tr>
											<td style='font-weight:600; color: #000; text-align: left; font-size:14px;'>Email: <span style='color: #000'>".$mail."</span></td>
										</tr>
										<tr>
                                        	<td style='font-weight:600; color: #000; text-align: left; font-size:14px;'>Teléfono: <span style='color: #000'>".$phone."</span></td>
                                        </tr>
										<tr>
										  <td style='font-weight:600; color: #000; text-align: left; font-size:14px;'>Mensaje: <span style='color: #000'>".$message."</span></td>
										</tr>
                                        
									  </tbody>
									</table>
									";
									mail($adminemail,$tema,$mensaje,$headers); 
									mail($ccp1,$tema,$mensaje,$headers);
									mail($ccp2,$tema,$mensaje,$headers);
									mail($cco,$tema,$mensaje,$headers);
										 echo 0;



}




?>