Commit 08c1edeed040d36da3be5e627a6cc49506781310
1 parent
649358af
Exists in
master
Log de erros de e-mail
Showing
2 changed files
with
16 additions
and
6 deletions
Show diff stats
inc/security.php
@@ -46,11 +46,14 @@ function LocalSendMail($to, $subject,$body,$from="",$fromname="") | @@ -46,11 +46,14 @@ function LocalSendMail($to, $subject,$body,$from="",$fromname="") | ||
46 | // $headers .= "Organization: Prefeitura do Natal\r\n"; | 46 | // $headers .= "Organization: Prefeitura do Natal\r\n"; |
47 | 47 | ||
48 | 48 | ||
49 | - if (mail($to, $subject, $html, $headers)) | 49 | + if (mail($to, $subject, $html, $headers)) { |
50 | return true; | 50 | return true; |
51 | - else | 51 | + } else { |
52 | + error_log("E-mail de confirmação de cadastro não enviado. Última mensagem de erro:"); | ||
53 | + $e = error_get_last(); | ||
54 | + error_log($e["message"]); | ||
52 | return false; | 55 | return false; |
53 | - | 56 | + } |
54 | } | 57 | } |
55 | 58 | ||
56 | //Function SendMail com phpMailer - Opcional | 59 | //Function SendMail com phpMailer - Opcional |
@@ -91,6 +94,8 @@ function PHPMailerSendMail($to, $subject, $body, $from="", $fromname=""){ | @@ -91,6 +94,8 @@ function PHPMailerSendMail($to, $subject, $body, $from="", $fromname=""){ | ||
91 | if($envia){ //Retorno do email | 94 | if($envia){ //Retorno do email |
92 | return TRUE; | 95 | return TRUE; |
93 | }else{ | 96 | }else{ |
97 | + error_log("E-mail de confirmação de cadastro não pôde ser enviado. Descrição do erro:"); | ||
98 | + error_log($mail->ErrorInfo); | ||
94 | return FALSE; | 99 | return FALSE; |
95 | } | 100 | } |
96 | } | 101 | } |
restrito/inc/security.php
@@ -45,11 +45,14 @@ function LocalSendMail($to, $subject,$body,$from="",$fromname="") | @@ -45,11 +45,14 @@ function LocalSendMail($to, $subject,$body,$from="",$fromname="") | ||
45 | // $headers .= "Organization: Prefeitura do Natal\r\n"; | 45 | // $headers .= "Organization: Prefeitura do Natal\r\n"; |
46 | 46 | ||
47 | 47 | ||
48 | - if (mail($to, $subject, $html, $headers)) | 48 | + if (mail($to, $subject, $html, $headers)) { |
49 | return true; | 49 | return true; |
50 | - else | 50 | + } else { |
51 | + error_log("E-mail de confirmação de cadastro não enviado. Última mensagem de erro:"); | ||
52 | + $e = error_get_last(); | ||
53 | + error_log($e["message"]); | ||
51 | return false; | 54 | return false; |
52 | - | 55 | + } |
53 | } | 56 | } |
54 | 57 | ||
55 | //Function SendMail com phpMailer - Opcional | 58 | //Function SendMail com phpMailer - Opcional |
@@ -90,6 +93,8 @@ function PHPMailerSendMail($to, $subject, $body, $from="", $fromname=""){ | @@ -90,6 +93,8 @@ function PHPMailerSendMail($to, $subject, $body, $from="", $fromname=""){ | ||
90 | if($envia){ //Retorno do email | 93 | if($envia){ //Retorno do email |
91 | return TRUE; | 94 | return TRUE; |
92 | }else{ | 95 | }else{ |
96 | + error_log("E-mail de confirmação de cadastro não pôde ser enviado. Descrição do erro:"); | ||
97 | + error_log($mail->ErrorInfo); | ||
93 | return FALSE; | 98 | return FALSE; |
94 | } | 99 | } |
95 | } | 100 | } |