get_variable('URA',true); $nomeCliente = $agi->get_variable('NOMECLI',true); $valorFatura = $agi->get_variable('VALORFATURAS', true); $email = $agi->get_variable('EMAILCLI', true); $celular =$agi->get_variable('CELULARCLIENTE', true); $codBarra = mt_rand(1000000, 999999999); if($opt == 1){ $email = EnviaSegundaViaEmail($nomeCliente, $email, $valorFatura); if(substr($email, 0,2) == 'Ok'){ $agi->exec_goto(GetAnuncio('FATURA_ENVIADA')); }else{ $agi->exec_goto(GetAnuncio('REDIRECIONA_ATENDIMENTO')); } } if($opt == 2){ $sms = enviaSMS($celular, $nomeCliente, $codBarra, $valorFatura); } } catch (Exception $ex) { $reg_msg = $ex->getMessage(); $reg_status_exec = 'Er'; __logStr("Envia Segunda Via", $reg_msg , $scrpt, true); } @AtualizaIntegracao($uid, $reg_retorno, $reg_msg, $reg_status_exec, $retorno_cliente); if (!$dadosIntegra) @grava_dadosIntegra($reg_retorno); function EnviaSegundaViaEmail($nomeCliente, $destinatario, $valorFatura) { $vencimento = date('d/m/Y'); if (empty($destinatario)) { throw new Exception("Erro - destinatário não pode estar vazio"); } try { $mail = new PHPMailer(true); // Passing `true` enables exceptions //Configurações do Servidor $mail->SMTPDebug = 2; // Enable verbose debug output $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'mail.simplesip.com.br'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = 'workflow@simplesip.com.br'; // SMTP username $mail->Password = '#w0rkFl0w@'; // SMTP password //$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 587; // TCP port to connect to //Remetente $mail->setFrom('desenvolvimento01@simplesip.com.br', 'Desenvolvimento01'); //Recebedores $mail->addAddress($destinatario, $nomeCliente); //Anexos $mail->addAttachment(); // Add attachments $mail->addAttachment("/var/lib/asterisk/scripts/workflow/logoPrincipal.jpg"); // Optional name //Conteudo $mail->isHTML(true); // Set email format to HTML $mail->Subject = 'NO-REPLY Fatura por Email Simples IP'; $mail->Body = "