<?php
include "class.phpmailer.php";
include "class.smtp.php";
//include "../config/config.php";







/*Registro y actualización de clientes*/
function register_client($email_user,$email_password,$from_name,$Host,$Port,$url_base,$client_email,$ruc){
	$the_subject = "HELP DESK - GRUPO CLISA";
	$address_to = $client_email;
	$phpmailer = new PHPMailer();
    $phpmailer->CharSet = 'UTF-8';
	// ---------- datos de la cuenta -------------------------------
	$phpmailer->Username = $email_user;
	$phpmailer->Password = $email_password; 
	//-----------------------------------------------------------------------
	// $phpmailer->SMTPDebug = 1;
	$phpmailer->Host = $Host; 
	$phpmailer->Port = $Port;
	$phpmailer->IsSMTP(); // use SMTP
	$phpmailer->SMTPAuth = true;
	//cambio en la configuración <----------------------------------------------
    $phpmailer->SMTPSecure = true;
    //cambio en la configuración <----------------------------------------------
	$phpmailer->setFrom($phpmailer->Username,$from_name);
	$phpmailer->AddAddress($address_to); // recipients email
	$phpmailer->Subject = $the_subject;	
	$phpmailer->Body ="<body style='background: #ecf0f5; margin: 0 auto;-webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;font-family: 'Source Sans Pro','Helvetica Neue',Helvetica,Arial,sans-serif; font-weight: 400;overflow-x: hidden;overflow-y: auto;     color: #333;font-size: 15px;line-height: 1.42857;'>
    <div style='width: 100%;'> 
		<div style='color:#3c8dbc' style='font-size: 35px;text-align: center;margin-bottom: 25px;font-weight: 300;'>
	        <div style='background: #fff none repeat scroll 0 0;border-radius: 3px;border-top: 3.5px solid #3c8dbc;box-shadow: 0 2px 2px rgba(0, 0, 0, 0.1);color: #666;padding: 20px;'>
	            <p style='margin: 0;text-align: center; padding: 0 20px 10px 20px;font-size: 17px; border-bottom: 1px solid #f4f4f4;'><i class='fa fa-user icon-title'></i>Departamento de IT <br>Bienvenido a nuestro sistema de HelpDesk</p>
	                    <p style='margin: 0;text-align: center; padding: 0 20px 10px 20px;font-size: 17px; border-bottom: 1px solid #f4f4f4;'><i class='fa fa-user icon-title'></i> Tus datos de acceso son: </p>
	            <br>
	                <div style='margin-bottom: 15px; margin-left:80px; font-size:17px;text-align: left;'>
	                    Correo electr&oacute;nico: <b>$client_email</b>
	                </div>
	                <div style='margin-bottom: 15px; margin-left:80px; font-size:17px;text-align: left;'>
	                    Clave de acceso al sistema: <b>$ruc</b>
	                </div>
	                <br>
	                <div class='row'>
	                    <div class='col-xs-12'>
	                    <a href=\"https://helpdesk.clisa.com\" target='_blank' style='background-color: #fa5448;width: 100%;color: #fff;text-decoration: none; -webkit-appearance: button;cursor: pointer;text-align: center;white-space: nowrap;vertical-align: center;font-weight: 400;margin-bottom: 0; height: 50px; font-size: 20px; padding: 8px 44px; border-radius: 10px;'>Ingresar</a>
	                    </div><!-- /.col -->
	                </div>
	        </div>
	    </div>
	</div>
</body>";
	$phpmailer->IsHTML(true);

	$phpmailer->Send();
}

function update_client($email_user,$email_password,$from_name,$Host,$Port,$url_base,$client_email,$password){
	$the_subject = "Actualizacion de datos!";
	$address_to = $client_email;
	$phpmailer = new PHPMailer();
    $phpmailer->CharSet = 'UTF-8';
	// ---------- datos de la cuenta-------------------------------
	$phpmailer->Username = $email_user;
	$phpmailer->Password = $email_password; 
	//-----------------------------------------------------------------------
	// $phpmailer->SMTPDebug = 1;
	$phpmailer->Host = $Host; // GMail
	$phpmailer->Port = $Port;
	$phpmailer->IsSMTP(); // use SMTP
	$phpmailer->SMTPAuth = true;
	//cambio en la configuración <----------------------------------------------
    $phpmailer->SMTPSecure = true;
    //cambio en la configuración <----------------------------------------------
	$phpmailer->setFrom($phpmailer->Username,$from_name);
	$phpmailer->AddAddress($address_to); // recipients email
	$phpmailer->Subject = $the_subject;	
	$phpmailer->Body ="<body style='background: #ecf0f5; margin: 0 auto;-webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;font-family: 'Source Sans Pro','Helvetica Neue',Helvetica,Arial,sans-serif; font-weight: 400;overflow-x: hidden;overflow-y: auto;     color: #333;font-size: 15px;line-height: 1.42857;'>
    <div style='width:100%;'> 
		<div style='color:#3c8dbc' style='font-size: 35px;text-align: center;margin-bottom: 25px;font-weight: 300;'>
	        <div style='background: #fff none repeat scroll 0 0;border-radius: 3px;border-top: 3.5px solid #3c8dbc;box-shadow: 0 2px 2px rgba(0, 0, 0, 0.1);color: #666;padding: 20px;'>
	                    <p style='margin: 0;text-align: center; padding: 0 20px 10px 20px;font-size: 17px; border-bottom: 1px solid #f4f4f4;'><i class='fa fa-user icon-title'></i>HELP DESK GRUPO CLISA</p>
	                    <p style='margin: 0;text-align: center; padding: 0 20px 10px 20px;font-size: 17px; border-bottom: 1px solid #f4f4f4;'><i class='fa fa-user icon-title'></i> Tus datos de acceso han sido modificados: </p>
	            <br>
	                <div style='margin-bottom: 15px; margin-left:80px; font-size:17px;text-align: left;'>
	                    Correo electr&oacute;nico: <b>$client_email</b>
	                </div>
	                <div style='margin-bottom: 15px; margin-left:80px; font-size:17px;text-align: left;'>
	                    Contrase&ntilde;a: <b>$password</b>
	                </div>
	                <br>
	                <div class='row'>
	                    <div class='col-xs-12'>
	                    <a href=\"$url_base\" target='_blank' style='background-color: #367fa9;width: 100%;color: #fff;text-decoration: none; -webkit-appearance: button;cursor: pointer;text-align: center;white-space: nowrap;vertical-align: middle;font-weight: 400;margin-bottom: 0; height: 40px; font-size: 20px; padding: 10px 44px; border-radius: 5px;'>Ingresar</a>
	                    </div><!-- /.col -->
	                </div>
	        </div>
	    </div>
	</div>
</body>";
	$phpmailer->IsHTML(true);
	$phpmailer->Send();
}





/*Registro y actualización de usuarios*/
function register_user($email_user,$email_password,$from_name,$Host,$Port,$url_base,$user_email,$username,$password){
	$the_subject = "HELP DESK - GRUPO CLISA";
	$address_to = $user_email;
	$phpmailer = new PHPMailer();
    $phpmailer->CharSet = 'UTF-8';
	// ---------- datos de la cuenta-------------------------------
	$phpmailer->Username = $email_user;
	$phpmailer->Password = $email_password; 
	//-----------------------------------------------------------------------
	// $phpmailer->SMTPDebug = 1;
	$phpmailer->Host = $Host; // GMail
	$phpmailer->Port = $Port;
	$phpmailer->IsSMTP(); // use SMTP
	$phpmailer->SMTPAuth = true;
	
	//cambio en la configuración <----------------------------------------------
    $phpmailer->SMTPSecure = true;
    //cambio en la configuración <----------------------------------------------
    
	$phpmailer->setFrom($phpmailer->Username,$from_name);
	$phpmailer->AddAddress($address_to); // recipients email
	$phpmailer->Subject = $the_subject;	
	$phpmailer->Body ="<body style='background: #ecf0f5; margin: 0 auto;-webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;font-family: 'Source Sans Pro','Helvetica Neue',Helvetica,Arial,sans-serif; font-weight: 400;overflow-x: hidden;overflow-y: auto;     color: #333;font-size: 15px;line-height: 1.42857;'>
    <div style='width:100%;'> 
		<div style='color:#3c8dbc' style='font-size: 35px;text-align: center;margin-bottom: 25px;font-weight: 300;'>
	        <div style='background: #fff none repeat scroll 0 0;border-radius: 3px;border-top: 3.5px solid #3c8dbc;box-shadow: 0 2px 2px rgba(0, 0, 0, 0.1);color: #666;padding: 20px;'>
	        <p style='margin: 0;text-align: center; padding: 0 20px 10px 20px;font-size: 17px; border-bottom: 1px solid #f4f4f4;'><i class='fa fa-user icon-title'></i>Departamento de IT <br>Bienvenido a nuestro sistema de HelpDesk</p>
	                    <p style='margin: 0;text-align: center; padding: 0 20px 10px 20px;font-size: 17px; border-bottom: 1px solid #f4f4f4;'><i class='fa fa-user icon-title'></i> Se te ha asigando un perfil de Agente de Soporte <br> Tus datos de acceso son:</p>
	            <br>

	                <div style='margin-bottom: 15px; margin-left:80px; font-size:17px;text-align: left;'>
	                    Correo electr&oacute;nico: <b>$user_email</b>
	                </div>
	                <div style='margin-bottom: 15px; margin-left:80px; font-size:17px;text-align: left;'>
	                    Usuario: <b>$username</b>
	                </div>
	                <div style='margin-bottom: 15px; margin-left:80px; font-size:17px;text-align: left;'>
	                    Contrase&ntilde;a: <b>$password</b>
	                </div>

	                <br>
	                <div class='row'>
	                    <div class='col-xs-12'>
							<a href=\"https://helpdesk.clisa.com/admin\" target='_blank' style='background-color: #367fa9;width: 100%;color: #fff;text-decoration: none; -webkit-appearance: button;cursor: pointer;text-align: center;white-space: nowrap;vertical-align: middle;font-weight: 400;margin-bottom: 0; height: 40px; font-size: 20px; padding: 10px 44px; border-radius: 5px;'>Ingresar</a>

	                    </div><!-- /.col -->
	                </div>
	        </div>
	    </div>
	</div>
</body>";
	$phpmailer->IsHTML(true);
	$phpmailer->Send();
}

































function emailSend($email, $number_ticket, $created_at, $name_area, $name_kind, $comment, $email_admin,$business){
	global  $email_smtp;
	global  $password_smtp;
	global  $Host_smtp;
	global  $Port_smtp;
	global  $from_name_smtp;
    
	$the_subject = "TICKET REGISTRADO";
	// $address_to = $email.",".$email_admin;
	$phpmailer = new PHPMailer();
    $phpmailer->CharSet = 'UTF-8';
	// ---------- datos de la cuenta -------------------------------
	$phpmailer->Username = $email_smtp;
	$phpmailer->Password = $password_smtp; 
	//-----------------------------------------------------------------------
	//$phpmailer->SMTPDebug = 1;
	$phpmailer->Host = $Host_smtp; 
	$phpmailer->Port = $Port_smtp;
	
    $phpmailer->IsSMTP(); // use SMTP
	//Whether to use SMTP authentication
    $phpmailer->SMTPAuth = true;
    
    
    //cambio en la configuración <----------------------------------------------
    $phpmailer->SMTPSecure = true;
    //cambio en la configuración <----------------------------------------------
    
    
    
	$phpmailer->setFrom($phpmailer->Username,$from_name_smtp);
	$phpmailer->AddAddress($email_admin);
	$phpmailer->addCC($email); // recipients email
	$phpmailer->Subject = $the_subject;	
	$phpmailer->Body ="<body>
	<table class='m_-7505156390771758409MsoNormalTable' border='0' cellspacing='3' cellpadding='0' width='100%' style='width:100.0%'>
		<tbody>
			<tr>
				<td width='40%' valign='top' style='width:40.0%;padding:.75pt .75pt .75pt .75pt'></td>
				<td width='60%' valign='top' style='width:60.0%;padding:.75pt .75pt .75pt .75pt'>
					<p class='MsoNormal' align='right' style='text-align:right'><strong><span style='font-size:18.0pt;color:#ea201b'>REGISTRADO</span></strong><br><strong><span style='font-size:13.5pt'>TICKET Nro.: $number_ticket </span></strong><br><span style='font-size:10.5pt'> $created_at </span> <u></u><u></u></p>
				</td>
				</tr>
		</tbody>
	</table>

	<p class='MsoNormal'><span style='font-family:&quot;Arial&quot;,sans-serif;display:none'><u></u>&nbsp;<u></u></span></p>

	<table class='m_-7505156390771758409MsoNormalTable' border='0' cellspacing='3' cellpadding='0' width='100%' style='width:100.0%'>
		<tbody>
			<tr>
				<td style='padding:.75pt .75pt .75pt .75pt'><p class='MsoNormal'><b><span style='font-size:13.5pt;color:#31b45a'>Su ticket ha sido registrado.</span></b><br><span style='font-size:10.5pt'>En breve le ser&aacute; asignado a un agente de Help Desk para atender su caso con la siguiente informaci&oacute;n:</span> <u></u><u></u></p>
				</td>
			</tr>
			<tr>
				<td style='padding:.75pt .75pt .75pt .75pt'>
				</td>
			</tr>
			</tbody>
	</table>

	<p class='MsoNormal'><span style='font-family:&quot;Arial&quot;,sans-serif;display:none'><u></u>&nbsp;<u></u></span></p>

	<table class='m_-7505156390771758409MsoNormalTable' border='1' cellspacing='3' cellpadding='0' width='100%' style='width:100.0%;border:solid #c6c6c6 1.5pt;border-radius:4px'>
		<tbody>
			<tr>
				<td width='29%' style='width:29.88%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'><p class='MsoNormal' style='line-height:20.4pt'><strong><span style='font-size:10.5pt'>Raz&oacute;n Social:</span></strong><span style='font-size:10.5pt'><u></u><u></u></span></p>
				</td>
				<td width='69%' style='width:69.72%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'><p class='MsoNormal' style='line-height:20.4pt'><span style='font-size:10.5pt'>$business<u></u><u></u></span></p>
				</td>
			</tr>
			<tr>
				<td width='29%' style='width:29.88%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'>
					<p class='MsoNormal' style='line-height:20.4pt'><strong><span style='font-size:10.5pt'>Area:</span></strong><span style='font-size:10.5pt'><u></u><u></u></span>
					</p>
				</td>
				<td width='69%' style='width:69.72%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'>
					<p class='MsoNormal' style='line-height:20.4pt'><span style='font-size:10.5pt'> Soporte T&eacute;cnico <u></u><u></u></span></p>
				</td>
			</tr>
			<tr>
				<td width='29%' style='width:29.88%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'>
					<p class='MsoNormal' style='line-height:20.4pt'><strong><span style='font-size:10.5pt'>Asunto del ticket:</span></strong><span style='font-size:10.5pt'><u></u><u></u></span></p>
				</td>
				<td width='69%' style='width:69.72%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'>
					<p class='MsoNormal' style='line-height:20.4pt'><span style='font-size:10.5pt'> $name_kind <u></u><u></u></span>
					</p>
				</td>
			</tr>
			<tr>
				<td width='29%' style='width:29.88%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'>
					<p class='MsoNormal' style='line-height:20.4pt'><strong><span style='font-size:10.5pt'>Detalle del problema:</span></strong><span style='font-size:10.5pt'><u></u><u></u></span>
					</p>
				</td>
				<td width='69%' style='width:69.72%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'>
					<p class='MsoNormal' style='line-height:20.4pt'>
						<span style='font-size:10.5pt'>$comment.<u></u><u></u></span>
					</p>
				</td>
			</tr>
		</tbody>
	</table>

	<p class='MsoNormal'><span style='font-family:&quot;Arial&quot;,sans-serif;display:none'><u></u>&nbsp;<u></u></span></p>

	<table class='m_-7505156390771758409MsoNormalTable' border='0' cellspacing='3' cellpadding='0' width='100%' style='width:100.0%'>
		<tbody>
			<tr>
				<td style='padding:.75pt .75pt .75pt .75pt'></td>	
			</tr>
			<tr>
				<td style='padding:.75pt .75pt .75pt .75pt'>
					<p><span style='font-size:10.5pt'>Atentamente,<u></u><u></u></span></p>
					<p><b><span style='font-size:10.5pt'>Departamento de IT</span></b><span style='font-size:10.5pt'><u></u><u></u></span></p>
				</td>
			</tr>
		</tbody>
	</table>

</body>";
	$phpmailer->IsHTML(true);
	//$phpmailer->Send();
	try {
    $phpmailer->send();
    //echo "Message has been sent successfully";
} catch (Exception $e) {
    echo "Mailer Error: " . $phpmailer->ErrorInfo;
}
}


function emailAsigned($email_client,$number_ticket,$atendido,$name_user,$email_user, $comment,$business){
	global  $email_smtp;
	global  $password_smtp;
	global  $Host_smtp;
	global  $Port_smtp;
	global  $from_name_smtp;
	$the_subject = "TICKET ASIGNADO";
	// $address_to = $email.",".$email_admin;
	$phpmailer = new PHPMailer();
    $phpmailer->CharSet = 'UTF-8';
	// ---------- datos de la cuenta -------------------------------
	$phpmailer->Username = $email_smtp;
	$phpmailer->Password = $password_smtp; 
	//-----------------------------------------------------------------------
	// $phpmailer->SMTPDebug = 1;
	$phpmailer->Host = $Host_smtp; 
	$phpmailer->Port = $Port_smtp;
	$phpmailer->IsSMTP(); // use SMTP
	$phpmailer->SMTPAuth = true;
	
	$phpmailer->SMTPSecure = true;
	
	
	$phpmailer->setFrom($phpmailer->Username,$from_name_smtp);
	$phpmailer->AddAddress($email_client); // recipients email
	$phpmailer->addCC($email_user);
	$phpmailer->Subject = $the_subject;	
	$phpmailer->Body ="<body>
	<table class='m_-7505156390771758409MsoNormalTable' border='0' cellspacing='3' cellpadding='0' width='100%' style='width:100.0%'>
		<tbody>
			<tr>
				<td width='40%' valign='top' style='width:40.0%;padding:.75pt .75pt .75pt .75pt'></td>
				<td width='60%' valign='top' style='width:60.0%;padding:.75pt .75pt .75pt .75pt'>
					<p class='MsoNormal' align='right' style='text-align:right'>
					<strong><span style='font-size:18.0pt;color:#ea201b'>ASIGNADO</span></strong>
					<br><strong><span style='font-size:13.5pt'>TICKET Nro.: $number_ticket</span></strong><br><span style='font-size:10.5pt'>$atendido</span> <u></u><u></u></p>
				</td>
			</tr>
		</tbody>
	</table>

	<table class='m_-7505156390771758409MsoNormalTable' border='0' cellspacing='3' cellpadding='0' width='100%' style='width:100.0%'>
		<tbody>
			
		</tbody>
	</table>
	<table class='m_-7505156390771758409MsoNormalTable' border='0' cellspacing='3' cellpadding='0' width='100%' style='width:100.0%'>
		<tbody>
			<tr>
				<td style='padding:.75pt .75pt .75pt .75pt'>
					<p class='MsoNormal'><b>
						<span style='font-size:13.5pt;color:#31b45a'>Su ticket ha sido asignado.</span></b><br>
						<span style='font-size:10.5pt'>En breve, un Agente de Help Desk se comunicar&aacute; con usted. En caso necesite enviarnos mayor informaci&oacute;n puede comunicarse a la direcci&oacute;n de correo del agente.</span> <u></u><u></u>
					</p>
				</td>
			</tr>
			<tr>
				<td style='padding:.75pt .75pt .75pt .75pt'></td>
			</tr>
		</tbody>
	</table>
	<table class='m_-7505156390771758409MsoNormalTable' border='1' cellspacing='3' cellpadding='0' width='100%' style='width:100.0%;border:solid #c6c6c6 1.5pt;border-radius:4px'>
		<tbody>
			<tr>
				<td width='29%' style='width:29.88%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'>
					<p class='MsoNormal' style='line-height:20.4pt'><strong><span style='font-size:10.5pt;color:#e83838'>Analista responsable:</span></strong><span style='font-size:10.5pt;color:#e83838'><u></u><u></u></span>
					</p>
				</td>
				<td width='69%' style='width:69.72%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'>
					<p class='MsoNormal' style='line-height:20.4pt'><span style='font-size:10.5pt'>$name_user, <a href=mailto:$email_user target='_blank'>$email_user</a><u></u><u></u></span>
					</p>
				</td>
			</tr>
			<tr>
				<td width='29%' style='width:29.88%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'>
					<p class='MsoNormal' style='line-height:20.4pt'><strong><span style='font-size:10.5pt'>Raz&oacute;n Social:</span></strong><span style='font-size:10.5pt'><u></u><u></u></span></p>
				</td>
				<td width='69%' style='width:69.72%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'>
					<p class='MsoNormal' style='line-height:20.4pt'><span style='font-size:10.5pt'>$business<u></u><u></u></span></p>
				</td>
			</tr>
			<tr>
				<td width='29%' style='width:29.88%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'>
					<p class='MsoNormal' style='line-height:20.4pt'><strong><span style='font-size:10.5pt'>Área:</span></strong><span style='font-size:10.5pt'><u></u><u>	</u></span>
					</p>
				</td>
				<td width='69%' style='width:69.72%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'>
					<p class='MsoNormal' style='line-height:20.4pt'><span style='font-size:10.5pt'>SOPORTE<u></u><u></u></span>
					</p>
				</td>
			</tr>
			
			<tr>
				<td width='29%' style='width:29.88%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'>
					<p class='MsoNormal' style='line-height:20.4pt'><strong><span style='font-size:10.5pt'>Asunto del ticket:</span></strong><span style='font-size:10.5pt'><u></u><u></u></span>
					</p>
				</td>
				<td width='69%' style='width:69.72%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'>
					<p class='MsoNormal' style='line-height:20.4pt'><span style='font-size:10.5pt'>$comment<u></u><u></u></span></p>
				</td>
			</tr>
		</tbody>
	</table>

	<table class='m_-7505156390771758409MsoNormalTable' border='0' cellspacing='3' cellpadding='0' width='100%' style='width:100.0%'>
		<tbody>
			<tr>
				<td style='padding:.75pt .75pt .75pt .75pt'></td>
			</tr>
			<tr>
				<td style='padding:.75pt .75pt .75pt .75pt'>
					<p><span style='font-size:10.5pt'>Atentamente,<u></u><u></u></span></p>
					<p><b><span style='font-size:10.5pt'>DEPARTAMENTO DE IT</span></b><span style='font-size:10.5pt'><u></u><u></u></span></p>
				</td>
			</tr>
		</tbody>
	</table>
</body>";
	$phpmailer->IsHTML(true);
	$phpmailer->Send();
}



function emailIncidencia($email_client,$number_ticket, $date, $incidencia, $name_user, $email_user, $comment, $name_kind){
	global  $email_smtp;
	global  $password_smtp;
	global  $Host_smtp;
	global  $Port_smtp;
	global  $from_name_smtp;
	$the_subject = "TICKET CON PAUSA";
	// $address_to = $email.",".$email_admin;
	$phpmailer = new PHPMailer();
    $phpmailer->CharSet = 'UTF-8';
	// ---------- datos de la cuenta -------------------------------
	$phpmailer->Username = $email_smtp;
	$phpmailer->Password = $password_smtp; 
	//-----------------------------------------------------------------------
	// $phpmailer->SMTPDebug = 1;
	$phpmailer->Host = $Host_smtp; 
	$phpmailer->Port = $Port_smtp;
	$phpmailer->IsSMTP(); // use SMTP
	$phpmailer->SMTPAuth = true;
	
	//cambio en la configuración <----------------------------------------------
    $phpmailer->SMTPSecure = true;
    //cambio en la configuración <----------------------------------------------
    
	$phpmailer->setFrom($phpmailer->Username,$from_name_smtp);
	$phpmailer->AddAddress($email_client); // recipients email
	$phpmailer->Subject = $the_subject;	
	$phpmailer->Body ="<body>
	<table class='m_-7505156390771758409MsoNormalTable' border='0' cellspacing='3' cellpadding='0' width='100%' style='width:100.0%'>
		<tbody>
			<tr>
				<td width='40%' valign='top' style='width:40.0%;padding:.75pt .75pt .75pt .75pt'></td>
				<td width='60%' valign='top' style='width:60.0%;padding:.75pt .75pt .75pt .75pt'>
					<p class='MsoNormal' align='right' style='text-align:right'>
						<strong>
							<span style='font-size:18.0pt;color:#ea201b'>PAUSA</span>
						</strong><br>
						<strong>
							<span style='font-size:13.5pt'>TICKET Nro.: $number_ticket</span>
						</strong><br>
						<span style='font-size:10.5pt'>$date</span> <u></u><u></u>
					</p>
				</td>
			</tr>
		</tbody>
		</table>
	<table class='m_-7505156390771758409MsoNormalTable' border='0' cellspacing='3' cellpadding='0' width='100%' style='width:100.0%'>
		<tbody>
			<tr>
				
			</tr>
		</tbody>
	</table>
	<table class='m_-7505156390771758409MsoNormalTable' border='0' cellspacing='3' cellpadding='0' width='100%' style='width:100.0%'>
		<tbody>
			<tr>
				<td style='padding:.75pt .75pt .75pt .75pt'><p class='MsoNormal'>
					<b><span style='font-size:13.5pt;color:#e83838'>Su caso presenta una pausa.</span></b><br><span style='font-size:10.5pt'>Parece que tenemos algunos imprevistos al intentar solucionar su ticket. Le agradeceremos comunicarse por correo electr&oacute;nico con el agente responsable, para solucionar su caso lo antes posible.</span> <u></u><u></u></p>
				</td>
			</tr>
			<tr>
				<td style='padding:.75pt .75pt .75pt .75pt'></td>
			</tr>
		</tbody>
	</table>
	<table class='m_-7505156390771758409MsoNormalTable' border='1' cellspacing='3' cellpadding='0' width='100%' style='width:100.0%;border:solid #c6c6c6 1.5pt;border-radius:4px'>
		<tbody>
			<tr>
				<td width='30%' style='width:30.0%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'>
					<p class='MsoNormal' style='line-height:18.0pt'>
						<strong><span style='color:#ea201b'>Detalle de la Pausa:</span></strong><span style='color:#ea201b'><u></u><u></u></span>
					</p>
				</td>
				<td width='70%' style='width:70.0%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'>
					<p class='MsoNormal' style='line-height:20.4pt'>
						<span style='font-size:10.5pt'>$incidencia<u></u><u></u></span>
					</p>
				</td>
			</tr>
			<tr>
				<td width='30%' style='width:30.0%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'>
					<p class='MsoNormal' style='line-height:18.0pt'>
						<strong><span style='color:#0066cc'>Recomendaci&oacute;n:</span></strong><span style='color:#0066cc'><u></u><u></u></span>
					</p>
				</td>
				<td width='70%' style='width:70.0%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'>
					<p class='MsoNormal' style='line-height:20.4pt'><span style='font-size:10.5pt'>Por favor, comun&iacute;quese con el agente responsable de su caso al correo electr&oacute;nico detallado a continuaci&oacute;n.<u></u><u></u></span>
					</p>
				</td>
			</tr>
			<tr>
				<td style='border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'></td>
				<td style='border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'></td>
			</tr>
			<tr>
				<td width='30%' style='width:30.0%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'>
					<p class='MsoNormal' style='line-height:20.4pt'><strong><span style='font-size:10.5pt'>Analista responsable:</span></strong><span style='font-size:10.5pt'><u></u><u></u></span></p>
				</td>
				<td width='70%' style='width:70.0%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'>
					<p class='MsoNormal' style='line-height:20.4pt'>
						<span style='font-size:10.5pt'>$name_user, <a href=mailto:$email_user target='_blank'>$email_user</a><u></u><u></u></span>
					</p>
				</td>
			</tr>
			<tr>
				<td width='30%' style='width:30.0%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'>
					<p class='MsoNormal' style='line-height:20.4pt'>
						<strong><span style='font-size:10.5pt'>Asunto del ticket:</span></strong><span style='font-size:10.5pt'><u></u><u></u></span>
					</p>
				</td>
				<td width='70%' style='width:70.0%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'>
					<p class='MsoNormal' style='line-height:20.4pt'><span style='font-size:10.5pt'>$comment<u></u><u></u></span></p>
				</td>
			</tr>
			<tr>
				<td width='30%' style='width:30.0%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'>
					<p class='MsoNormal' style='line-height:20.4pt'><strong><span style='font-size:10.5pt'>Área:</span></strong><span style='font-size:10.5pt'><u></u><u></u></span></p>
				</td>
				<td width='70%' style='width:70.0%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'>
					<p class='MsoNormal' style='line-height:20.4pt'><span style='font-size:10.5pt'>SOPORTE<u></u><u></u></span>
					</p>
				</td>
			</tr>
		</tbody>
	</table>
	<table class='m_-7505156390771758409MsoNormalTable' border='0' cellspacing='3' cellpadding='0' width='100%' style='width:100.0%'>
		<tbody>
			<tr>
				<td style='padding:.75pt .75pt .75pt .75pt'></td>
			</tr>
			<tr>
				<td style='padding:.75pt .75pt .75pt .75pt'>
					<p>
						<span style='font-size:10.5pt'>Atentamente,<u></u><u></u></span>
					</p>
					<p>
						<b><span style='font-size:10.5pt'>DEPARTAMENTO DE IT</span></b><span style='font-size:10.5pt'><u></u><u></u></span>
					</p>
				</td>
			</tr>
		</tbody>
	</table>
</body>";
	$phpmailer->IsHTML(true);
	$phpmailer->Send();
}



function emailFinish($number_ticket, $atendido, $email_client, $business, $name_area, $comment, $comentario){
	global  $email_smtp;
	global  $password_smtp;
	global  $Host_smtp;
	global  $Port_smtp;
	global  $from_name_smtp;
	$the_subject = "TICKET FINALIZADO";
	// $address_to = $email.",".$email_admin;
	$phpmailer = new PHPMailer();
    $phpmailer->CharSet = 'UTF-8';
	// ---------- datos de la cuenta -------------------------------
	$phpmailer->Username = $email_smtp;
	$phpmailer->Password = $password_smtp; 
	//-----------------------------------------------------------------------
	// $phpmailer->SMTPDebug = 1;
	$phpmailer->Host = $Host_smtp; 
	$phpmailer->Port = $Port_smtp;
	$phpmailer->IsSMTP(); // use SMTP
	$phpmailer->SMTPAuth = true;
	
	//cambio en la configuración <----------------------------------------------
    $phpmailer->SMTPSecure = true;
    //cambio en la configuración <----------------------------------------------
    
	$phpmailer->setFrom($phpmailer->Username,$from_name_smtp);
	$phpmailer->AddAddress($email_client); // recipients email
	$phpmailer->Subject = $the_subject;	
	$phpmailer->Body ="<body>
	<table class='m_-7505156390771758409MsoNormalTable' border='0' cellspacing='3' cellpadding='0' width='100%' style='width:100.0%'>
		<tbody>
			<tr>
				<td width='40%' valign='top' style='width:40.0%;padding:.75pt .75pt .75pt .75pt'></td>
				<td width='60%' valign='top' style='width:60.0%;padding:.75pt .75pt .75pt .75pt'>
					<p class='MsoNormal' align='right' style='text-align:right'><strong><span style='font-size:18.0pt;color:#31b45a'>Solucionado</span></strong><br><strong><span style='font-size:13.5pt'>TICKET Nro.: $number_ticket</span></strong><br><span style='font-size:10.5pt'>$atendido</span> <u></u><u></u></p>
				</td>
				</tr>
		</tbody>
	</table>
	<table class='m_-7505156390771758409MsoNormalTable' border='0' cellspacing='3' cellpadding='0' width='100%' style='width:100.0%'>
		<tbody>
			
		</tbody>
	</table>

	<p class='MsoNormal'><span style='font-family:&quot;Arial&quot;,sans-serif;display:none'><u></u>&nbsp;<u></u></span></p>

	<table class='m_-7505156390771758409MsoNormalTable' border='0' cellspacing='3' cellpadding='0' width='100%' style='width:100.0%'>
		<tbody>
			<tr>
				<td style='padding:.75pt .75pt .75pt .75pt'><p class='MsoNormal'><b><span style='font-size:13.5pt;color:#31b45a'>Su ticket ha sido atendido exitosamente.</span></b><br><span style='font-size:10.5pt'></span> <u></u><u></u></p>
				</td>
			</tr>
			<tr>
				<td style='padding:.75pt .75pt .75pt .75pt'>
				</td>
			</tr>
			</tbody>
	</table>

	<p class='MsoNormal'><span style='font-family:&quot;Arial&quot;,sans-serif;display:none'><u></u>&nbsp;<u></u></span></p>

	<table class='m_-7505156390771758409MsoNormalTable' border='1' cellspacing='3' cellpadding='0' width='100%' style='width:100.0%;border:solid #c6c6c6 1.5pt;border-radius:4px'>
		<tbody>
			<tr>
				<td width='29%' style='width:29.88%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'><p class='MsoNormal' style='line-height:20.4pt'><strong><span style='font-size:10.5pt'>Raz&oacute;n Social:</span></strong><span style='font-size:10.5pt'><u></u><u></u></span></p>
				</td>
				<td width='69%' style='width:69.72%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'><p class='MsoNormal' style='line-height:20.4pt'><span style='font-size:10.5pt'>$business<u></u><u></u></span></p>
				</td>
			</tr>
			<tr>
				<td width='29%' style='width:29.88%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'>
					<p class='MsoNormal' style='line-height:20.4pt'><strong><span style='font-size:10.5pt'>Area:</span></strong><span style='font-size:10.5pt'><u></u><u></u></span>
					</p>
				</td>
				<td width='69%' style='width:69.72%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'>
					<p class='MsoNormal' style='line-height:20.4pt'><span style='font-size:10.5pt'>Soporte T&eacute;cnico<u></u><u></u></span></p>
				</td>
			</tr>
			<tr>
				<td width='29%' style='width:29.88%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'>
					<p class='MsoNormal' style='line-height:20.4pt'><strong><span style='font-size:10.5pt'>Asunto del ticket:</span></strong><span style='font-size:10.5pt'><u></u><u></u></span></p>
				</td>
				<td width='69%' style='width:69.72%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'>
					<p class='MsoNormal' style='line-height:20.4pt'><span style='font-size:10.5pt'>$comment <u></u><u></u></span>
					</p>
				</td>
			</tr>
			<tr>
				<td width='29%' style='width:29.88%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'>
					<p class='MsoNormal' style='line-height:20.4pt; color:red'><strong><span style='font-size:10.5pt'>Comentario:</span></strong><span style='font-size:10.5pt'><u></u><u></u></span>
					</p>
				</td>
				<td width='69%' style='width:69.72%;border:none;padding:7.5pt 7.5pt 7.5pt 7.5pt'>
					<p class='MsoNormal' style='line-height:20.4pt'>
						<span style='font-size:10.5pt'>$comentario.<u></u><u></u></span>
					</p>
				</td>
			</tr>
		</tbody>
	</table>
	
	<p>
	Por favor, dedique uno minuto a completar esta peque&ntilde;a encuesta, la informaci&oacute;n que nos proporcione ser&aacute; muy &uacute;til para mejorar nuestro servicio: 
    <a href='https://forms.office.com/Pages/ResponsePage.aspx?id=dGU1GgmA_0qCz5ZysP2WtCuI3ZnC9zlLgohJUnPS_dZUQzhNWFI3TEhOTTRMSjNQNjFVMFJXWkVaNC4u&embed=true'>Haga clic aquí</a>
    
	</p>

	<p class='MsoNormal'><span style='font-family:&quot;Arial&quot;,sans-serif;display:none'><u></u>&nbsp;<u></u></span></p>

	<table class='m_-7505156390771758409MsoNormalTable' border='0' cellspacing='3' cellpadding='0' width='100%' style='width:100.0%'>
		<tbody>
			<tr>
				<td style='padding:.75pt .75pt .75pt .75pt'></td>	
			</tr>
			<tr>
				<td style='padding:.75pt .75pt .75pt .75pt'>
					<p><span style='font-size:10.5pt'>Atentamente,<u></u><u></u></span></p>
					<p><b><span style='font-size:10.5pt'>Departamento de IT</span></b><span style='font-size:10.5pt'><u></u><u></u></span></p>
				</td>
			</tr>
		</tbody>
	</table>
</body>";
	$phpmailer->IsHTML(true);
	$phpmailer->Send();
}