public function testSMTPMailerSetConf()
 {
     $conf_in = array('default_from' => array('name' => 'abc-silverstripe-mailer-from', 'email' => '*****@*****.**'), 'charset_encoding' => 'utf-8', 'server' => 'mail.mailinator.com', 'port' => 25, 'secure' => null, 'authenticate' => false, 'user' => '', 'pass' => '', 'debug' => 2, 'lang' => 'en');
     SMTPMailer::set_conf($conf_in);
     $conf_out = (array) SMTPMailer::get_conf();
     $this->assertEquals($conf_in, $conf_out);
 }
    public function send_mail($total)
    {
        $html = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
			"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
			<html xmlns="http://www.w3.org/1999/xhtml">
			<head>
			<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
			<title>Sistema Sistecart - Cron Chamados</title>
			</head>
			<body style="font-family:Verdana, Geneva, sans-serif; font-size:12px">
			São Paulo, ' . date('d') . ' de ' . $mes . ' de ' . date('Y') . '.<br /> 
			Hora: ' . date('H') . ':' . date('i') . '. <br /><br />
			
			Foi(ram) cadastrado(s) ' . $total . ' chamado(s) no sistema.<br /><br />

			Atenciosamente,<br />
			Equipe Cartório Postal.
			</body>
			</html>';
        include "../../includes/maladireta/class.PHPMailer.php";
        $mailer = new SMTPMailer();
        $From = 'Sistema';
        $AddAddress = 'ti@cartoriopostal.com.br,TI;';
        $Subject = 'TI - Cron Chamados';
        $mailer->SEND($From, $AddAddress, '', '', '', $Subject, $html);
    }
Example #3
0
/**   Function used to send email 
 *   $module 		-- current module 
 *   $to_email 	-- to email address 
 *   $from_name	-- currently loggedin user name
 *   $from_email	-- currently loggedin ec_users's email id. you can give as '' if you are not in HelpDesk module
 *   $subject		-- subject of the email you want to send
 *   $contents		-- body of the email you want to send
 *   $cc		-- add email ids with comma seperated. - optional 
 *   $bcc		-- add email ids with comma seperated. - optional.
 *   $attachment	-- whether we want to attach the currently selected file or all ec_files.[values = current,all] - optional
 *   $emailid		-- id of the email object which will be used to get the ec_attachments
 */
function send_webmail($module, $to_email, $from_name, $from_email, $subject, $contents, $cc = '', $bcc = '', $attachment = '', $emailid = '')
{
    global $adb, $log;
    $log->debug("Entering send_webmail() method ...");
    $smtphandle = new SMTPMailer();
    if (!isset($_SESSION["MAILLIST_PLAINTEXT"])) {
        $smtphandle->UseHTML(1);
        // set email format to HTML
        $headertag = "<HEAD><META http-equiv=\"Content-Type\" content=\"text/html; charset=GBK\"></HEAD>";
        $contents = from_html($contents);
        $contents = eregi_replace('<BODY', $headertag . '<BODY', $contents);
    }
    $smtphandle->charset = 'GBK';
    //convert UTF-8 to GBK
    $subject = iconv_ec("UTF-8", "GBK", $subject);
    $contents = iconv_ec("UTF-8", "GBK", $contents);
    $emailid = iconv_ec("UTF-8", "GBK", $emailid);
    //$from_email = "";
    $smtphandle->subject = $subject;
    $smtphandle->body = $contents;
    $res = $adb->query("select * from ec_systems where server_type='email'");
    $rownum = $adb->num_rows($res);
    if ($rownum == 0) {
        return "No Smtp Server!";
    }
    $server = $adb->query_result($res, 0, 'server');
    $username = $adb->query_result($res, 0, 'server_username');
    $password = $adb->query_result($res, 0, 'server_password');
    $smtp_auth = $adb->query_result($res, 0, 'smtp_auth');
    $server_port = $adb->query_result($res, 0, 'server_port');
    if ($from_email == '') {
        $from_email = $adb->query_result($res, 0, 'from_email');
    }
    if ($from_name == '') {
        $from_name = $adb->query_result($res, 0, 'from_name');
    }
    $from_name = iconv_ec("UTF-8", "GBK", $from_name);
    $from_email = iconv_ec("UTF-8", "GBK", $from_email);
    $smtphandle->SetHost($server, $server_port);
    $smtphandle->UseAuthLogin($username, $password);
    $smtphandle->SetFrom($from_email, $from_name);
    $smtphandle->AddReplyTo($from_email, $from_name);
    if ($to_email != '') {
        if (is_array($to_email)) {
            for ($j = 0, $num = count($to_email); $j < $num; $j++) {
                $smtphandle->AddTo($to_email[$j]);
            }
        } else {
            $_tmp = explode(",", $to_email);
            for ($j = 0, $num = count($_tmp); $j < $num; $j++) {
                $smtphandle->AddTo($_tmp[$j]);
            }
        }
    }
    if ($cc != '') {
        if (is_array($cc)) {
            for ($j = 0, $num = count($cc); $j < $num; $j++) {
                $smtphandle->AddCc($cc[$j]);
            }
        } else {
            $_tmp = explode(",", $cc);
            for ($j = 0, $num = count($_tmp); $j < $num; $j++) {
                $smtphandle->AddCc($_tmp[$j]);
            }
        }
    }
    if ($bcc != '') {
        if (is_array($bcc)) {
            for ($j = 0, $num = count($bcc); $j < $num; $j++) {
                $smtphandle->AddBcc($bcc[$j]);
            }
        } else {
            $_tmp = explode(",", $bcc);
            for ($j = 0, $num = count($_tmp); $j < $num; $j++) {
                $smtphandle->AddBcc($_tmp[$j]);
            }
        }
    }
    if ($attachment != "") {
        $query = "select * from ec_attachments where attachmentsid='" . $attachment . "'";
        $result = $adb->query($query);
        $rownum = $adb->num_rows($result);
        if ($rownum > 0) {
            $attachmentsid = $adb->query_result($result, 0, 'attachmentsid');
            $filename = $adb->query_result($result, 0, 'name');
            $filename = iconv_ec("UTF-8", "GBK", $filename);
            $encode_filename = base64_encode_filename($adb->query_result($result, 0, 'name'));
            $filepath = $adb->query_result($result, 0, 'path');
            $filetype = $adb->query_result($result, 0, 'type');
            global $root_directory;
            $fullpath = $root_directory . $filepath . $attachmentsid . "_" . $encode_filename;
            $log->info("send_webmail :: fullpath:" . $fullpath);
            if (file_exists($fullpath)) {
                $attachment_status = $smtphandle->AddAttachment($fullpath, $filename, $filetype);
                if (!$attachment_status) {
                    $log->info("send_webmail :: errormsg:" . $smtphandle->errormsg);
                }
            }
        }
    }
    $errMsg = "";
    $sentmsg = $smtphandle->Send();
    if ($sentmsg === false) {
        $errMsg = $smtphandle->errormsg . '<br>';
        $log->info("send_webmail :: errormsg:" . $smtphandle->errormsg);
    }
    $log->debug("Exit send_webmail() method ...");
    return $errMsg;
}
        break;
}
if ($action == 1) {
    $HTML = '
	<!DOCTYPE HTML>
	<html lang="pt-br"><head><meta charset="utf-8"><style>body{font-family:Arial; font-size:14px}</style></head><body>
	<table style="font-size: 13px; font-family: Arial">
		<tr>
			<td colspan="2">&nbsp;</td>
			<td style="border:solid 1px #222; text-align:center;" colspan="2">Ins. / Upd.</td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td style="border:solid 1px #222; text-align:center; width: 20%">Data</td>
			<td style="border:solid 1px #222; text-align:center; width: 10%">Total</td>
			<td style="border:solid 1px #222; text-align:center; width: 10%">Sim</td>
			<td style="border:solid 1px #222; text-align:center; width: 10%">Não</td>
			<td style="border:solid 1px #222;">Ação</td>
		</tr>' . $ret . '
	</table>
</body></html>';
    include "../../includes/maladireta/class.PHPMailer.php";
    $mailer = new SMTPMailer();
    $mailer->SEND('Sistema Novo', '*****@*****.**', '', '', '', 'Cron ' . $_GET['action'] . ' Sistema Novo - ' . $msg, $HTML);
    if ($_GET['action'] + 1 < $total) {
        header('location: cron-novo-sistema.php?action=' . ($_GET['action'] + 1));
    }
    echo $total;
} else {
    echo 'Null';
}
Seu login é: ' . $usuario->email . '<br>
E sua senha de acesso é: ' . $senha . '<br><br>

Para entrar no sistema acesse www.cartoriopostal.com.br/login/ faça login na área corporativa para acessar o <strong style="color:#FF0000">Sistema Corporativo</strong>.<br>
Seu login e senha só funcionará quando a franquia for inaugurada.

Para entrar no nosso Serviço de Atendimento a Franquia (SAF) acesse www.cartoriopostal.com.br/login/ e faça login.<br>
Você pode acessar o SAF a qualquer momento, mesmo antes da inauguração da sua unidade.

Caso contrário envie um e-mail para ti@cartoriopostal.com.br<br><br>

Att,<br>
Equipe Cartório Postal<br>
';
    include "../../includes/maladireta/class.PHPMailer.php";
    $mailer = new SMTPMailer();
    $From = 'Sistema Cartório Postal';
    $AddAddress = $usuario->email . ',' . $nome;
    $AddBCC = '';
    if ($controle_id_usuario != 1) {
        $AddBCC = '*****@*****.**';
    }
    $mailer->SEND($From, $AddAddress, $AddCC, $AddBCC, '', $Subject, $html);
    echo '<div id="meio"><br>Mensagem enviada com sucesso!<br>

<a href="usuario.php"> Clique aqui para voltar!</a><br/>
<a href="usuario_add.php"> Adicionar outro usuário!</a>';
    echo '<br><br>Senha Atual: ' . $senha;
    echo '</div>';
}
include 'footer.php';
$HTML .= '</table>';
$HTML .= '<script type="text/javascript">';
$HTML .= "\n\tgoogle.load('visualization', '1.0', {'packages':['corechart']});\n\tgoogle.setOnLoadCallback(drawChart);\n\t\n\t function drawChart() {\n        var data = new google.visualization.DataTable();\n        data.addColumn('string', 'Topping');\n        data.addColumn('number', 'Slices');\n        data.addRows([";
$i = 0;
foreach ($status as $b => $res) {
    $HTML .= "['" . strtoupper(strtolower($res->status)) . "', " . $total_rows[$i] . "]";
    $HTML .= $i < count($status) - 1 ? "," : "";
    $i++;
}
$HTML .= "]);        \n        var options = {'title':'Relatorio Expansao - " . $dia . "',\n                       'width':800,\n                       'height':600};\n        var chart = new google.visualization.PieChart(document.getElementById('chart_div'));\n        chart.draw(data, options);\n     }";
$HTML .= '</script><div id="chart_div"></div>';
$HTML .= '</body>
</html>';
#echo $HTML; exit;
if (date('H') < 21) {
    echo $HTML;
} else {
    #echo 2; exit;
    include "../../includes/maladireta/class.PHPMailer.php";
    $mailer = new SMTPMailer();
    $From = 'Sistema Expansão';
    if ($_GET['teste'] == 1) {
        $AddAddress = '*****@*****.**';
    } else {
        #$AddAddress = '*****@*****.**';
        $AddAddress = 'flavio.lopes@cartoriopostal.com.br;elizabeth.costa@cartoriopostal.com.br;claudia.mattos@cartoriopostal.com.br;jefferson.ramirez@cartoriopostal.com.br';
    }
    $AddBCC = '*****@*****.**';
    $Subject = 'Relatório Expansão';
    $mailer->SEND($From, $AddAddress, '', $AddBCC, '', $Subject, $HTML);
}
<?php

ini_set('max_execution_time', '0');
require "../model/Database.php";
require "../includes/classQuery.php";
require "../includes/funcoes.php";
require "../includes/global.inc.php";
require "../classes/spreadsheet_excel_writer/Writer.php";
//require_once("../includes/maladireta/class.Email.php");
require "../../includes/maladireta/class.PHPMailer.php";
$mailer = new SMTPMailer();
$AddBCC = '*****@*****.**';
$AddCC = '';
$id_empresa_cont = $_GET['id_empresa'];
$empresaDAO = new EmpresaDAO();
$pedidoDAO = new PedidoDAO();
$relatorioDAO = new RelatorioDAO();
$contaDAO = new ContaDAO();
$retorna = 1;
$html = 'Consoante a assinatura do contrato de franquia firmado entre Vossa Senhoria e a Franqueadora, informamos que o boleto para pagamento dos Royalties, bem como o valor e dados para depósito do FPP, apurados no mês anterior estão disponíveis para download no sistema.<br><br>
Para acessá-lo será necessário clicar no menu:<br>
<b>INICIAR > RELÁTÓRIOS > RELATÓRIO DE ROYALTIES E FATURAMENTO</b><br><br>

E baixar o boleto e o relatório para conferencia dos valores e faturamento.

Reforçamos nossa parceria.<br><br>
Atenciosamente,<br>
Equipe Cartório Postal.<br>
<br>';
function mesesEntreDatas($data1, $data2)
{
Example #8
0
 /**
  * Send the email.
  * @return boolean
  */
 function send()
 {
     $recipients = $this->getRecipientString();
     $from = $this->getFromString();
     $subject = String::encode_mime_header($this->getSubject());
     $body = $this->getBody();
     // FIXME Some *nix mailers won't work with CRLFs
     if (Core::isWindows()) {
         // Convert LFs to CRLFs for Windows
         $body = String::regexp_replace("/([^\r]|^)\n/", "\$1\r\n", $body);
     } else {
         // Convert CRLFs to LFs for *nix
         $body = String::regexp_replace("/\r\n/", "\n", $body);
     }
     if ($this->getContentType() != null) {
         $this->addHeader('Content-Type', $this->getContentType());
     } elseif ($this->hasAttachments()) {
         // Only add MIME headers if sending an attachment
         $mimeBoundary = '==boundary_' . md5(microtime());
         /* Add MIME-Version and Content-Type as headers. */
         $this->addHeader('MIME-Version', '1.0');
         $this->addHeader('Content-Type', 'multipart/mixed; boundary="' . $mimeBoundary . '"');
     } else {
         $this->addHeader('Content-Type', 'text/plain; charset="' . Config::getVar('i18n', 'client_charset') . '"');
     }
     $this->addHeader('X-Mailer', 'Public Knowledge Project Suite v2');
     $remoteAddr = Request::getRemoteAddr();
     if ($remoteAddr != '') {
         $this->addHeader('X-Originating-IP', $remoteAddr);
     }
     $this->addHeader('Date', date('D, d M Y H:i:s O'));
     /* Add $from, $ccs, and $bccs as headers. */
     if ($from != null) {
         $this->addHeader('From', $from);
     }
     $ccs = $this->getCcString();
     if ($ccs != null) {
         $this->addHeader('Cc', $ccs);
     }
     $bccs = $this->getBccString();
     if ($bccs != null) {
         $this->addHeader('Bcc', $bccs);
     }
     $headers = '';
     foreach ($this->getHeaders() as $header) {
         if (!empty($headers)) {
             $headers .= MAIL_EOL;
         }
         $headers .= $header['name'] . ': ' . str_replace(array("\r", "\n"), '', $header['content']);
     }
     if ($this->hasAttachments()) {
         // Add the body
         $mailBody = 'This message is in MIME format and requires a MIME-capable mail client to view.' . MAIL_EOL . MAIL_EOL;
         $mailBody .= '--' . $mimeBoundary . MAIL_EOL;
         $mailBody .= sprintf('Content-Type: text/plain; charset=%s', Config::getVar('i18n', 'client_charset')) . MAIL_EOL . MAIL_EOL;
         $mailBody .= wordwrap($body, MAIL_WRAP, MAIL_EOL) . MAIL_EOL . MAIL_EOL;
         // Add the attachments
         $attachments = $this->getAttachments();
         foreach ($attachments as $attachment) {
             $mailBody .= '--' . $mimeBoundary . MAIL_EOL;
             $mailBody .= 'Content-Type: ' . str_replace('"', '', $attachment['filename']) . '; name="' . $attachment['filename'] . '"' . MAIL_EOL;
             $mailBody .= 'Content-transfer-encoding: base64' . MAIL_EOL;
             $mailBody .= 'Content-disposition: ' . $attachment['disposition'] . MAIL_EOL . MAIL_EOL;
             $mailBody .= $attachment['content'] . MAIL_EOL . MAIL_EOL;
         }
         $mailBody .= '--' . $mimeBoundary . '--';
     } else {
         // Just add the body
         $mailBody = wordwrap($body, MAIL_WRAP, MAIL_EOL);
     }
     if ($this->getEnvelopeSender() != null) {
         $additionalParameters = '-f ' . $this->getEnvelopeSender();
     } else {
         $additionalParameters = null;
     }
     if (HookRegistry::call('Mail::send', array(&$this, &$recipients, &$subject, &$mailBody, &$headers, &$additionalParameters))) {
         return;
     }
     // Replace all the private parameters for this message.
     if (is_array($this->privateParams)) {
         foreach ($this->privateParams as $name => $value) {
             $mailBody = str_replace($name, $value, $mailBody);
         }
     }
     if (Config::getVar('email', 'smtp')) {
         $smtp =& Registry::get('smtpMailer', true, null);
         if ($smtp === null) {
             import('lib.pkp.classes.mail.SMTPMailer');
             $smtp = new SMTPMailer();
         }
         $sent = $smtp->mail($this, $recipients, $subject, $mailBody, $headers);
     } else {
         $sent = String::mail($recipients, $subject, $mailBody, $headers, $additionalParameters);
     }
     if (!$sent) {
         if (Config::getVar('debug', 'display_errors')) {
             if (Config::getVar('email', 'smtp')) {
                 fatalError("There was an error sending this email.  Please check your PHP error log for more information.");
                 return false;
             } else {
                 fatalError("There was an error sending this email.  Please check your mail log (/var/log/maillog).");
                 return false;
             }
         } else {
             return false;
         }
     } else {
         return true;
     }
 }
Example #9
0
function send_webmail($to_email, $from_name, $from_email, $subject, $contents, $sjid = '')
{
    ini_set('date.timezone', 'Asia/Shanghai');
    global $adb, $log;
    global $current_user;
    $log->debug("Entering send_webmail() method ...");
    $smtphandle = new SMTPMailer();
    if (!isset($_SESSION["MAILLIST_PLAINTEXT"])) {
        $smtphandle->UseHTML(1);
        // set email format to HTML
        $headertag = "<HEAD><META http-equiv=\"Content-Type\" content=\"text/html; charset=GBK\"></HEAD>";
        $contents = from_html($contents);
        $contents = eregi_replace('<BODY', $headertag . '<BODY', $contents);
    }
    $smtphandle->charset = 'GBK';
    //convert UTF-8 to GBK
    $subject = iconv_ec("UTF-8", "GBK", $subject);
    $contents = iconv_ec("UTF-8", "GBK", $contents);
    //$from_name = iconv_ec("UTF-8","GBK",$from_name);
    //$from_email = "";
    $smtphandle->subject = $subject;
    $smtphandle->body = $contents;
    $res = $adb->query("select * from ec_systems where server_type='email' and smownerid='" . $current_user->id . "'");
    $rownum = $adb->num_rows($res);
    if ($rownum == 0) {
        return "No Smtp Server!";
    }
    $server = $adb->query_result($res, 0, 'server');
    $username = $adb->query_result($res, 0, 'server_username');
    $password = $adb->query_result($res, 0, 'server_password');
    $smtp_auth = $adb->query_result($res, 0, 'smtp_auth');
    $server_port = $adb->query_result($res, 0, 'server_port');
    $from_email = $adb->query_result($res, 0, 'from_email');
    $from_name = $adb->query_result($res, 0, 'from_name');
    $from_name = iconv_ec("UTF-8", "GBK", $from_name);
    $from_email = iconv_ec("UTF-8", "GBK", $from_email);
    $smtphandle->SetHost($server, $server_port);
    $smtphandle->UseAuthLogin($username, $password);
    $smtphandle->SetFrom($from_email, $from_name);
    $smtphandle->AddReplyTo($from_email, $from_name);
    if ($to_email != '') {
        $smtphandle->AddTo($to_email);
    }
    if ($sjid != "") {
        $query = "select ec_attachments.* from ec_attachments " . " inner join ec_attachmentsjrel on ec_attachmentsjrel.attachmentsid = ec_attachments.attachmentsid " . "where ec_attachmentsjrel.sjid={$sjid} and ec_attachments.deleted=0 order by ec_attachments.attachmentsid asc";
        $result = $adb->query($query);
        $rownum = $adb->num_rows($result);
        if ($rownum > 0) {
            while ($row = $adb->fetch_array($result)) {
                $attachmentsid = $row['attachmentsid'];
                $filename = $row['name'];
                $filename = iconv_ec("UTF-8", "GBK", $filename);
                $encode_filename = base64_encode_filename($row['name']);
                $filepath = $row['path'];
                $filetype = $row['type'];
                global $root_directory;
                $fullpath = $root_directory . $filepath . $attachmentsid . "_" . $encode_filename;
                $log->info("send_webmail :: fullpath:" . $fullpath);
                if (file_exists($fullpath)) {
                    $attachment_status = $smtphandle->AddAttachment($fullpath, $filename, $filetype);
                    if (!$attachment_status) {
                        $log->info("send_webmail :: errormsg:" . $smtphandle->errormsg);
                    }
                }
            }
        }
    }
    $errMsg = "";
    $sentmsg = $smtphandle->Send();
    if ($sentmsg === false) {
        $errMsg = $smtphandle->errormsg . '<br>';
        $log->info("send_webmail :: errormsg:" . $smtphandle->errormsg);
    }
    $log->debug("Exit send_webmail() method ...");
    return $errMsg;
}
<?php

require "../model/Database.php";
require "../includes/classQuery.php";
require "../includes/funcoes.php";
require "../includes/global.inc.php";
require "../classes/spreadsheet_excel_writer/Writer.php";
//require_once("../includes/maladireta/class.Email.php");
require "../../includes/maladireta/class.PHPMailer.php";
$mailer = new SMTPMailer();
$AddBCC = '*****@*****.**';
$AddCC = '*****@*****.**';
$empresaDAO = new EmpresaDAO();
$empresas = $empresaDAO->listarRoyAtrasado();
$empresas_venc = array();
echo '<pre>';
switch (date('m')) {
    case 1:
        $mes = "Janeiro";
        break;
    case 2:
        $mes = "Fevereiro";
        break;
    case 3:
        $mes = "Março";
        break;
    case 4:
        $mes = "Abril";
        break;
    case 5:
        $mes = "Maio";
    public function email_finalizar($c)
    {
        $b = $c;
        $c = $this->selFicha($c->id_ficha);
        if ($c->id_empresa == 0) {
            $c->cpf = str_replace('.', '', $c->cpf);
            $c->cpf = str_replace(',', '', $c->cpf);
            $c->cpf = str_replace('/', '', $c->cpf);
            $c->cpf = str_replace('-', '', $c->cpf);
            $tipo = strlen($c->cpf) <= 11 ? 'cpf' : 'cnpj';
            $c->cpf = $tipo == 'cpf' ? $this->mask($c->cpf, '###.###.###-##') : $this->mask($c->cpf, '##.###.###/####-##');
            $fantasia = $c->cidade_interesse . ' - ' . $c->estado_interesse;
            $this->sql = 'INSERT INTO vsites_user_empresa (empresa,fantasia,tipo,cpf,rg,nome,
				cel,tel,tel_err,email,endereco,complemento,numero,cidade,estado,bairro,cep,
				data,chat,ultima_acao,status,ramal,franquia,ip,imposto,royalties,fax,modalidade,sigla_cidade,
				id_banco,agencia,conta,favorecido,imagem,interrede,adendo_data,adendo,inicio,sem1,sem2,sem3,roy_min,
				roy_min2,inauguracao_data,validade_contrato,modalidade_c,data_cof,precontrato,aditivo,exclusividade,
				notificacao,franquia_tipo,id_recursivo) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,
				?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)';
            $c->tipo_franquia = $c->tipo_franquia == '' ? 2 : $c->tipo_franquia;
            $this->values = array($c->empresa_t, $fantasia, $tipo, $c->cpf, $c->rg, $c->nome, $c->tel_rec, $c->tel_res, $c->tel_cel, '', $c->endereco, $c->complemento, $c->numero, $c->cidade, $c->estado, $c->bairro, $c->cep, null, null, null, 'Implantação', null, null, null, '0.00', '0.00', null, null, null, null, null, null, null, '', 0, '0000-00-00', 0, '0000-00-00', '0.00', '0.00', '0.00', '0.00', '0.00', '0000-00-00', '0000-00-00', '', '0000-00-00', '0000-00-00', '0000-00-00', 0, '', $c->tipo_franquia, 0);
            $this->exec();
            $this->sql = "SELECT e.* FROM vsites_user_empresa AS e WHERE e.cpf = ?";
            $this->values = array($c->cpf);
            $ret = $this->fetch();
            if (count($ret) > 0) {
                $this->sql = "SELECT e.* FROM vsites_user_empresa_implantacao AS e WHERE e.id_empresa = ?";
                $this->values = array($ret[0]->id_empresa);
                $ret1 = $this->fetch();
                if (count($ret1) == 0) {
                    $this->sql = "INSERT INTO vsites_user_empresa_implantacao (id_empresa,id_ficha,id_usuario,id_consultor1,id_consultor2,franqueado,telefone1,telefone2,\n\t\t\t\t\t\temail,endereco,numero,complemento,bairro,cep,cidade,uf) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
                    $this->values = array($ret[0]->id_empresa, $c->id_ficha, $c->id_usuario, 0, 0, $c->nome, $c->tel_res, $c->tel_rec, $c->email, $c->endereco, $c->numero, $c->complemento, $c->bairro, $c->cep, $c->cidade, $c->uf);
                    $this->exec();
                }
                $this->sql = "SELECT a.* FROM site_ficha_anexos AS a WHERE a.id_ficha = ? AND a.ativo = 1";
                $this->values = array($c->id_ficha);
                $ret2 = $this->fetch();
                if (count($ret2) > 0) {
                    $i = 0;
                    foreach ($ret2 as $d => $res) {
                        if (!is_dir("../uploads/" . date('Ym'))) {
                            mkdir("../uploads/" . date('Ym'), 0777);
                        }
                        $origem = $res->arquivo;
                        $destino = explode('/', $res->arquivo);
                        $extensao = explode('.', $destino[count($destino) - 1]);
                        $extensao = $extensao[1];
                        $destino = "../uploads/" . date('Ym') . '/' . $destino[count($destino) - 1];
                        copy($origem, $destino);
                        $novo_arquivo = date('YmdHis') . $i . '.' . $extensao;
                        rename($destino, "../uploads/" . date('Ym') . '/' . $novo_arquivo);
                        $this->sql = "INSERT INTO vsites_user_empresa_upload (id_empresa,id_usuario,ativo,arquivo,data) \n\t\t\t\t\t\t\tVALUES (?,?,?,?,?)";
                        $this->values = array($ret[0]->id_empresa, $b->c_id_usuario, 1, date('Ym') . '/' . $novo_arquivo, date('Y-m-d H:i:s'));
                        $this->exec();
                        $i++;
                    }
                }
            }
            $this->sql = 'UPDATE site_ficha_cadastro SET id_empresa = ?, id_status  = ? WHERE id_ficha = ?';
            $this->values = array($ret[0]->id_empresa, 18, $c->id_ficha);
            $this->exec();
            $html = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
				"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
				<html xmlns="http://www.w3.org/1999/xhtml">
				<head>
				<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
				<title>Sistema Sistecart - Cadastrar Franquia</title>
				</head>
				<body style="font-family:Verdana, Geneva, sans-serif; font-size:12px">
				Prezados,<br /><br /> Foi criada a franquia de número ' . $ret[0]->id_empresa . ' no sistema.<br /><br />
				Para dar continuidade o depto. de TI deve primeiramente seguir os seguintes passos:<br /><br />
				- alterar o status da franquia (' . $ret[0]->fantasia . ') de "Implantação" para "Ativo";<br />
				- verifique os dados de cadastros; e <br />
				- crie os e-mails e usuários para a franquia.<br /><br />
				Com isso, o depto. de Implantação pode prosseguir e completar o restante do processo.<br /><br />	
				
				Obrigado.<br /><br />

				<a href="http://www.cartoriopostal.com.br/sistema/controle/franquias_editar.php?id=' . $ret[0]->id_empresa . '" target="_blank">Clique aqui</a> 
				e siga os passos abaixo:<br />
				<font size="4" style="font-weight:bold">Escolha a aba que deseja visualizar > 00 - Dados da Franquia</font><br /><br />

				São Paulo, ' . date('d') . ' de ' . $mes . ' de ' . date('Y') . '.<br /> 
				Hora: ' . date('H') . ':' . date('i') . '. <br /><br />

				Atenciosamente,<br />
				Equipe Cartório Postal.
				</body>
				</html>';
            include "../../includes/maladireta/class.PHPMailer.php";
            $mailer = new SMTPMailer();
            $From = 'Sistema Expansão';
            $AddAddress = 'ti@cartoriopostal.com.br,TI;';
            $AddAddress .= 'nivaldo.silva@cartoriopostal.com.br,Nivaldo Silva';
            $AddCC = $c->user_email . ',' . $c->user_nome;
            $AddBCC = '*****@*****.**';
            $Subject = 'Expansão - Cadastrar Franquia';
            $mailer->SEND($From, $AddAddress, $AddCC, $AddBCC, '', $Subject, $html);
        }
        header('Location: fichas-editar.php?id_ficha=' . $c->id_ficha . '&aba=4');
    }
Example #12
0
function testmailer($email_title, $email_body)
{
    if ($email_title == "" || $email_body == "") {
        file_put_contents("result.txt", "email body or title is null\n", FILE_APPEND);
        exit("email body or title is null");
    }
    require "SMTPMailer.php";
    //	file_put_contents("result.txt","log report:\n");
    $emails = array("*****@*****.**", "*****@*****.**", "*****@*****.**");
    $email_num = count($emails);
    $curr_num = 0;
    $sucess_num = 0;
    $fail_num = 0;
    for ($i = 0; $i < $email_num; $i++) {
        $mailer = new SMTPMailer();
        $mailer->Host = "202.38.64.8";
        $mailer->UserName = "";
        $mailer->Password = "";
        $mailer->From = "";
        $mailer->ContentType = "text/html";
        $mailer->Subject = $email_title;
        $mailer->Body = $email_body;
        $mailer->To = $emails[$i];
        $curr_num++;
        if ($mailer->Send()) {
            $sucess_num++;
            //file_put_contents("result.txt","($curr_num)$emails[$i] sucessful_sended! [$sucess_num sucess, $fail_num failed]\n",FILE_APPEND);
        } else {
            $fail_num++;
            if (strstr($mailer->Error, "Recipient") !== false) {
                $connection = mysql_connect("localhost", "mydonor", "MYDONOR@))(") or die("Unable toconnect!");
                mysql_select_db("mydonor") or die("Unable to select database!");
                mysql_query("SET NAMES UTF8");
                $query = "update if_donor_email set priority = -1 where email_addr = '" . $emails[$i] . "'";
                $result = mysql_query($query);
                $error = mysql_error();
                //file_put_contents("result.txt", "($curr_num) $emails[$i] ".$mailer->Error." [$sucess_num sucess, $fail_num failed][set_invalid_email_priority=-1: $result $error]\n",FILE_APPEND);
            } else {
                //file_put_contents("result.txt", "($curr_num) $emails[$i] ".$mailer->Error." [$sucess_num sucess, $fail_num failed]\n",FILE_APPEND);
            }
        }
        echo $mailer->Info;
        sleep(2);
    }
    //sumary of this task
    //	file_put_contents("result.txt","sumary:\n",FILE_APPEND);
    //	file_put_contents("result.txt","the number of emails to be send is: $email_num\n",FILE_APPEND);
    //	file_put_contents("result.txt","the number of emails sended sucessfully is: $sucess_num\n",FILE_APPEND);
    //	file_put_contents("result.txt","the number of emails failed to be sended is: $fail_num\n",FILE_APPEND);
}
Example #13
0
     foreach ($the_titles as $key => $value) {
         $st = '%' . $value . '%';
         $the_titles[$key] = $st;
     }
 }
 $numemails = count($allemails);
 if ($max_emails) {
     $numemails = $max_emails;
 }
 if ($numemails > $tot_emails) {
     $numemails = $tot_emails;
 }
 /**
  * Create SMTP
  */
 $smtpMailer = new SMTPMailer();
 if (isset($_POST['chk_smtp']) && $_POST['chk_smtp'] == 'external') {
     if (!trim($_POST['smtp_host']) | !trim($_POST['smtp_port']) | !trim($_POST['smtp_username']) | !trim($_POST['smtp_password'])) {
         print "Please complete SMTP info";
         exit;
     }
     $intPattern = "/([0-9]{2,4})\$/";
     if (!preg_match($intPattern, trim($_POST['smtp_port']), $matches)) {
         print "Invalid SMTP Port";
         exit;
     }
     $smtpMailer->setSmtpHost(trim($_POST['smtp_host']));
     $smtpMailer->setSmtpUsername(trim($_POST['smtp_username']));
     $smtpMailer->setSmtpPassword(trim($_POST['smtp_password']));
     $smtpMailer->setSmtpPort($_POST['smtp_port']);
     if (isset($_POST['chk_smtp_secure'])) {
Example #14
0
 /**
  * Sends notice-emails to the Receivers
  * @param  array(MessageAdminReceivers) $receivers
  * @return array(MessageAdminReceivers) the receivers were the email
  * couldnt be send to
  */
 private function sendEmails($receivers)
 {
     require_once PATH_INCLUDE . '/email/SMTPMailer.php';
     $usersNotSend = array();
     //the Email could not be send to these users
     $userdata = $this->sendEmailsFetchUserdata($receivers);
     $mailer = new SMTPMailer($this->_interface);
     $mailer->smtpDataInDatabaseLoad();
     $mailer->emailFromXmlLoad(PATH_INCLUDE . '/email/Babesk_Nachricht_Info.xml');
     foreach ($userdata as $user) {
         $mailer->AddAddress($user->email);
         if ($user->email != '' && $mailer->Send()) {
             //everything fine
         } else {
             $usersNotSend[] = $user;
         }
         $mailer->ClearAddresses();
     }
     return $usersNotSend;
 }
<html>
<body>
<?php 
include "../../includes/maladireta/class.PHPMailer.php";
$mailer = new SMTPMailer();
$From = 'Sistema Teste';
$AddAddress = '';
$AddCC = '';
$AddBCC = '';
$Subject = 'Email Teste';
$Body = 'corpo do email<br /> teste.<br />' . date('Y-m-d H:i:s');
if ($mailer->SEND($From, $AddAddress, $AddCC, $AddBCC, $AddReplyTo, $Subject, $Body) == 1) {
    echo 'enviado';
} else {
    echo 'problema';
}
?>
</body>
</html>