Created
June 29, 2018 01:00
-
-
Save sibaberpollo/7e2ec03fae3bc65abb1b9cc8aa680875 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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úmero de registro:</td> | |
<td width="80%"><b>'.$datos['RegistroN'].'</b></td> | |
</tr> | |
<tr> | |
<td width="20%">Categorí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ía total de 1 año desde la fecha de compra, | |
si éste presenta alguna falla o daño haz el remplazo de tu producto solicitando | |
tu garantí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í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> ".$datos['RegistroN']."<br>"; | |
foreach ($datos['datosv'] as $key => $value) { | |
$dataFalla .= "<b>".$key.": </b> ".$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