From bc180b66e9602230a7e8f429d26e8f0c5cbe186c Mon Sep 17 00:00:00 2001 From: Greyce Medeiros Date: Wed, 14 Oct 2015 15:52:31 -0300 Subject: [PATCH] Inserção do PHP MAILER na estrutura de security.php --- restrito/inc/security.php | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/restrito/inc/security.php b/restrito/inc/security.php index affa9b8..0eb1c7e 100644 --- a/restrito/inc/security.php +++ b/restrito/inc/security.php @@ -47,6 +47,48 @@ function sendMail($to, $subject,$body,$from="",$fromname="") } +//Funcao email para Linux - PHP MAILER + + +function sendMail($to, $subject, $body, $from="", $fromname=""){ + require_once("../class/PHPMailerAutoload.php"); + $mail = new PHPMailer(); + $mail->isSMTP(); // Define que a mensagem será SMTP + $mail->Host = "0.0.0.0"; //hostname ou IP do Servidor + //$mail->SMTPAuth = true; //Caso seu email precise de autenticação, no nosso caso não. + //$mail->Username = "seuemail@dominio.com"; + //$mail->Passowrd = "sua senha"; + if(empty($from)){ + $sql = "SELECT nomeremetenteemail, emailremetente FROM lda_configuracao"; + $rs = execQuery($sql); + $row = mysql_fetch_array($rs); + $mail->From = $row['emailremetente']; + $mail->FromName = $row['nomeremetenteemail']; + }else{ + $mail->From = $from; + $mail->FromName = $fromname; + } + $mail->addAddress($to); + $mail->isHTML(true); //Define que o email será HTML + $mail->CharSet = "iso-8859-1"; //Charset da mensagem (opcional) + $mail->Subject = $subject; + $html = " + + $body + + "; + $mail->Body = $html; + $mail->AltBody = $body; //Texto Plano (opcional) + $envia = $mail->send(); //Envia o email + $mail->clearAllRecipients(); //Limpa os destinatarios + if($envia){ //Retorno do email + return TRUE; + }else{ + return FALSE; + } +} + + function sendMailAnexo($to, $subject,$body,$arquivos=array(),$from="",$fromname="",$cc="") { @@ -367,4 +409,4 @@ function isauth($tipo="consumidor") { session_start(); -?> \ No newline at end of file +?> -- libgit2 0.21.2