Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once("conexion.php");
- $conexion = conexion ();
- $getpermiso=mysqli_query($conexion,"SELECT * FROM permiso" );
- while($row =mysqli_fetch_array($getpermiso)){
- $f_vencimiento= $row['f_vencimiento'];
- $datetime1 = new DateTime("now");
- $datetime2 = date_create($row['f_vencimiento']);
- $interval = date_diff($datetime1, $datetime2);
- $dias= $interval->format('%a');
- echo $dias;
- if ($dias==60 || $dias==29 || $dias==0){
- require 'PHPMailer/PHPMailerAutoload.php';
- $mail = new PHPMailer();
- //$body = file_get_contents('inicio.php');
- $mail->IsSMTP();
- $mail->Host = 'smtp.gmail.com';
- $mail->SMTPAuth= true;
- $mail->Username='';
- $mail->Password='';
- $mail->Port = 587;
- //$mail->SMTPDebug = 2;
- $mail->SMTPSecure = 'tls';
- $mail->SetFrom('', 'Ender Chacon');
- $mail->AddAddress($row['correo'], 'Supervisor');
- $mail->AddAddress($row['correo0'], 'Supervisor');
- $mail->AddAddress($row['correo1'], 'Supervisor');
- $mail->Subject = 'Vencimiento de Permiso Bomberos';
- $mail->Body = '<justify><b>Estimado el sistemas de Permisos de Bomberos Le informa:</b><br>
- Que el Permiso Numero: '.$row['id'].' de la oficina:'.$row['oficina'].' vence el dia:'.$row['f_vencimiento'].' por favor<br>
- por la oficina mas cercana con los siguientes requisitos: <br><br><br>
- 1) Cedula de Identidad <br>
- 2) Registro Mercantil <br>
- 3) Registro de Informacion Fiscal <br></justify>';
- $mail->AltBody = "Saludos y Gracias Por su atencion";
- if(!$mail->Send()) {
- echo 'Error : ' . $mail->ErrorInfo;
- } else {
- echo 'ENVIADO!!';
- }
- }
- else {
- echo "no enviado";
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement