Commit 2111e7cd60b6613339b3b520797efac88b13310e

Authored by Greyce Medeiros
1 parent d557fab8
Exists in master

Insercao correta do phh Mailer no security.php -Principal e security.php - Restrito

Showing 2 changed files with 46 additions and 2 deletions   Show diff stats
inc/security.php
... ... @@ -11,6 +11,7 @@
11 11 require_once ("database.php");
12 12 require_once ("funcoes.php");
13 13  
  14 +
14 15 function sendMail($to, $subject,$body,$from="",$fromname="")
15 16 {
16 17 //se nao for informado o remetente, recupera das configurações do sistema
... ... @@ -46,7 +47,48 @@ function sendMail($to, $subject,$body,$from="",$fromname="")
46 47 return false;
47 48  
48 49 }
  50 +/*
  51 + //Function SendMail com phpMailer - Opcional
  52 +
  53 +function sendMail($to, $subject, $body, $from="", $fromname=""){
  54 + require_once("../class/PHPMailerAutoload.php");
  55 + $mail = new PHPMailer();
  56 + $mail->isSMTP(); // Define que a mensagem será SMTP
  57 + $mail->Host = "0.0.0.0"; //hostname ou IP do Servidor
  58 + //$mail->SMTPAuth = true; //Caso seu email precise de autenticação, no nosso caso não.
  59 + //$mail->Username = "seuemail@dominio.com";
  60 + //$mail->Passowrd = "sua senha";
  61 + if(empty($from)){
  62 + $sql = "SELECT nomeremetenteemail, emailremetente FROM lda_configuracao";
  63 + $rs = execQuery($sql);
  64 + $row = mysql_fetch_array($rs);
  65 + $mail->From = $row['emailremetente'];
  66 + $mail->FromName = $row['nomeremetenteemail'];
  67 + }else{
  68 + $mail->From = $from;
  69 + $mail->FromName = $fromname;
  70 + }
  71 + $mail->addAddress($to);
  72 + $mail->isHTML(true); //Define que o email será HTML
  73 + $mail->CharSet = "iso-8859-1"; //Charset da mensagem (opcional)
  74 + $mail->Subject = $subject;
  75 + $html = "<html>
  76 + <body>
  77 + $body
  78 + </body>
  79 + </html>";
  80 + $mail->Body = $html;
  81 + $mail->AltBody = $body; //Texto Plano (opcional)
  82 + $envia = $mail->send(); //Envia o email
  83 + $mail->clearAllRecipients(); //Limpa os destinatarios
  84 + if($envia){ //Retorno do email
  85 + return TRUE;
  86 + }else{
  87 + return FALSE;
  88 + }
  89 +}
49 90  
  91 +*/
50 92  
51 93 function sendMailAnexo($to, $subject,$body,$arquivos=array(),$from="",$fromname="",$cc="")
52 94 {
... ...
restrito/inc/security.php
... ... @@ -47,8 +47,8 @@ function sendMail($to, $subject,$body,$from=&quot;&quot;,$fromname=&quot;&quot;)
47 47  
48 48 }
49 49  
50   -//Funcao email para Linux - PHP MAILER
51   -
  50 +/*
  51 + //Function SendMail com phpMailer - Opcional
52 52  
53 53 function sendMail($to, $subject, $body, $from="", $fromname=""){
54 54 require_once("../class/PHPMailerAutoload.php");
... ... @@ -88,6 +88,8 @@ function sendMail($to, $subject, $body, $from=&quot;&quot;, $fromname=&quot;&quot;){
88 88 }
89 89 }
90 90  
  91 +*/
  92 +
91 93  
92 94  
93 95 function sendMailAnexo($to, $subject,$body,$arquivos=array(),$from="",$fromname="",$cc="")
... ...