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 | 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 | 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 | 55 | return false; |
53 | - | |
56 | + } | |
54 | 57 | } |
55 | 58 | |
56 | 59 | //Function SendMail com phpMailer - Opcional |
... | ... | @@ -91,6 +94,8 @@ function PHPMailerSendMail($to, $subject, $body, $from="", $fromname=""){ |
91 | 94 | if($envia){ //Retorno do email |
92 | 95 | return TRUE; |
93 | 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 | 99 | return FALSE; |
95 | 100 | } |
96 | 101 | } | ... | ... |
restrito/inc/security.php
... | ... | @@ -45,11 +45,14 @@ function LocalSendMail($to, $subject,$body,$from="",$fromname="") |
45 | 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 | 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 | 54 | return false; |
52 | - | |
55 | + } | |
53 | 56 | } |
54 | 57 | |
55 | 58 | //Function SendMail com phpMailer - Opcional |
... | ... | @@ -90,6 +93,8 @@ function PHPMailerSendMail($to, $subject, $body, $from="", $fromname=""){ |
90 | 93 | if($envia){ //Retorno do email |
91 | 94 | return TRUE; |
92 | 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 | 98 | return FALSE; |
94 | 99 | } |
95 | 100 | } | ... | ... |