This topic is locked

Como configurar para receber mensagens de erro por email

5/10/2011 2:06:08 PM
PHPRunner Tips and Tricks
E
ericholiveira author

Esta alteração foi realizada para que todo erro no sistema seja encaminhado por email para o desenvolvedor,
Altere o arquivo

C:\Program Files\PHPRunner5.3\source\include\phpfunctions.php
Localize a linha que contém

$xt->display('error.htm'); logo abaixo cole o codigo

$msg = '



<style>

table.errTable {

border: 0px;

width: 900px;

background-color: #000000;

text-align: left;

}

table.errTable tr {

background-color: #ccccff;

}

.tableHeader {

background-color: #ccccff;

}

.grayCell {

background-color: #cccccc;

width: 85%;

}

.debugInfoTable {

background-color: #cccccc;

border-collapse: collapse;

}

.debugInfoTable td {

border: 1px solid black;

}

table.debugInfoTable tr {

background-color: #cccccc;

}

.errDesc {

color: #cc3300;

}

.secondHeader {

text-align: center;

}

</style>
<strong>Funcionario: </strong> '. $_SESSION["nomelogado"].'
<strong>Empresa: </strong> '. $_SESSION["nomempresalogado"].'
<strong>Matricula:</strong> '. $_SESSION["matriculalogado"].'
<strong>Setor:</strong> '. $_SESSION["nomesetorlogado"].'
<strong>CPF:</strong> '. $_SESSION["cpflogado"].'
<strong>EMAIL:</strong> '. $_SESSION["emaillogado"].'
<table cellpadding="3" cellspacing="1" align="center" class="errTable">



<th>

<td colspan=2 align=middle><font size=+1><b>INFORMACOES TECNICAS</b></font></td>

</th>

<tr>

<td><b>Tipo de Erro</b></td>

<td class="grayCell">'.$errno.'</td>

</tr>

<tr>

<td><b>Descricao do Erro</b></td>

<td class="grayCell"><span class="errDesc">'.$errstr.'</span></td>

</tr>

<tr>

<td><b>URL</b></td>

<td class="grayCell">'.$url.'</td>

</tr>

<tr>

<td><b>Arquivo de Erro</b></td>

<td class="grayCell">'.$errfile.'</td>

</tr>

<tr>

<td><b>Linha com Erro</b></td>

<td class="grayCell">'.$errline.'</td>

</tr>

<tr>

<td ><b>Consulta de SQL</b></td>

<td class="grayCell">'.$sqlStr.'</td>

</tr>

</table>';



require_once('base/phpMailer/class.phpmailer.php');

$mailer = new PHPMailer();

$mailer->IsSMTP(); //usar autenticacao

$mailer->Port = 587; //Indica a porta de conexao para a saiada de e-mails geralmente

$mailer->Host = 'smtp.dominio.com.br'; //servidor de autenticacao

$mailer->SMTPAuth = true; //define se havera ou nao autenticacao no SMTP

$mailer->Username = 'webmaster@dominio.com.br'; //Informe o e-mai o completo

$mailer->Password = '123456'; //Senha da caixa postal

$mailer->FromName = "WEBMASTER"; //Nome que sera exibido para o destinatario

$mailer->From ="webmaster@engelmig.com.br"; //Obrigatorio ser a mesma caixa postal indicada em "username"

$mailer->Subject ="[ERRO NO SISTEMA]"; //Assunto

$mailer->AddAddress("seunome@dominio.com.br","ERRO NO SISTEMA"); //Destinatarios

$mailer->AddReplyTo($_SESSION["emaillogado"], $_SESSION["nomelogado"]);

$mailer->Body = $msg;

$mailer->MsgHTML($msg);

$mailer->Send();

$mailer->ClearAddresses();


Faça as adaptações nas variaveis de sessao e no caminho da classe phpMailer

http://sourceforge.net/projects/phpmailer/

Sergey Kornilov admin 5/10/2011

My Portuguese is not very good but PHPRunner already includes PHPMailer. You can use runner_mail() function.

E
ericholiveira author 5/10/2011



My Portuguese is not very good but PHPRunner already includes PHPMailer. You can use runner_mail() function.


yes, but in my application I had a problem with SMTP authentication in runner_mail, or do not know use the function, then used that way.
How to use SMTP authentication?

Sergey Kornilov admin 5/10/2011

Security->User login settings->Use custom mail server settings

E
ericholiveira author 5/11/2011



Security->User login settings->Use custom mail server settings



thanks