Skip to content

Instantly share code, notes, and snippets.

@sibaberpollo
Created June 29, 2018 01:00
Show Gist options
  • Save sibaberpollo/7e2ec03fae3bc65abb1b9cc8aa680875 to your computer and use it in GitHub Desktop.
Save sibaberpollo/7e2ec03fae3bc65abb1b9cc8aa680875 to your computer and use it in GitHub Desktop.
function enviacorreo($datos){
$para = $datos['mail'];
$copiaMail = "";
$enviarCopia;
if ($datos['tipomens']===1)
{
$asunto = "Registro de falla producto Somela";
$mensaje = "Hemos recibido tu Solicitud de Garantía. Ésta será analizada por el área técnica y se te indicará las acciones a seguir. Número de registro: <b>".$datos['RegistroN']."</b>";
$copiaMail = "postvtasomela.chile@electrolux.com";
$enviarCopia = true;
}
else{
$asunto = "Registro de nuevo producto Somela";
//$resto= '';
$mensaje = '
<p>Muchas gracias por registrar tu producto</p>
<table width="80%">
<tr>
<td width="20%">N&uacute;mero de registro:</td>
<td width="80%"><b>'.$datos['RegistroN'].'</b></td>
</tr>
<tr>
<td width="20%">Categor&iacute;a:</td>
<td width="80%">'.$datos['datosv']['categoria'].'</td>
</tr>
<tr>
<td width="20%">Modelo:</td>
<td width="80%">'.$datos['datosv']['modelo'].'</td>
</tr>
<tr>
<td width="20%">Fecha de compra:</td>
<td width="80%">'.date("d-m-Y", strtotime($datos['datosv']['fechacompra'])).'</td>
</tr>
</table>
<table width="80%">
<tr>
<td>
Tu producto Somela cuenta con garant&iacute;a total de 1 a&ntilde;o desde la fecha de compra,
si &eacute;ste presenta alguna falla o da&ntilde;o haz el remplazo de tu producto solicitando
tu garant&iacute;a.
</td>
</tr>
<tr align="center">
<td align="center" height="100">
<a href="https://ec.hcsda.cl/servicio-al-cliente/solicitud-de-garantia/" style="-webkit-border-radius: 10;-moz-border-radius: 10;border-radius: 10px;font-family: Arial;color:#ffffff;font-size: 16px;background: #ff4c00;padding: 10px 20px 10px 20px;text-decoration: none;text-transform:uppercase;">Solicita tu garant&iacute;a</a>
</td>
</tr>
</table>
';
}
$mail = new PHPMailer(true);
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Host='mail.somela.cl';
$mail->Port='465';
$mail->Username = 'info@somela.cl';
$mail->Password = 'PAFEsD2:S]N:P9';
//$mail->From = 'ventas@hcsda.cl';
//$mail->FromName = "Somela";
$mail->AddReplyTo('postvtaeluxsda.chile@electrolux.com', 'Postventas');
$mail->setFrom('info@somela.cl', 'Somela');
$mail->SMTPKeepAlive = true;
$mail->Mailer = "smtp";
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->CharSet = 'utf-8';
$mail->SMTPDebug = 0;
$mail->AddAddress($para);
$mail->Subject = $asunto;
$mail->Body = $mensaje;
$mail->IsHTML(true);
$mail->Send();
if($enviarCopia == true):
$mail->ClearAddresses();
$mail->AddAddress($copiaMail);
$mail->AddBCC("jpino@tmpchile.cl", "Pino");
$mail->AddBCC("jorge.a.gutierrez@electrolux.com", "Jorge");
$dataFalla .= "<b>Registro:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".$datos['RegistroN']."<br>";
foreach ($datos['datosv'] as $key => $value) {
$dataFalla .= "<b>".$key.": </b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".$value."<br>";
}
$mail->IsHTML(true);
$mail->Body = $dataFalla;
$mail->Send();
endif;
/*
if ($mail->Send()) return 1;
else return 0;
*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment