示例#1
1
 public function handle($fromTitle, $fromMail, $toEmail, $subject, $body, $attachments, $smtpHost, $smtpPort, $serverLogin = '', $serverPassword = '', $charCode = 'UTF-8', $isHtml = false)
 {
     if (!is_object($this->_mail)) {
         $this->_mail = new PHPMailer();
     }
     $this->_mail->CharSet = $charCode;
     $this->_mail->IsHTML($isHtml);
     $this->_mail->From = $fromMail;
     $this->_mail->FromName = $fromTitle;
     $this->_mail->AddReplyTo($fromMail, $fromTitle);
     $this->_mail->Subject = $subject;
     $this->_mail->Body = $body;
     $this->_mail->AltBody = '';
     $this->_mail->AddAddress($toEmail, '');
     $this->_mail->IsSMTP(true);
     $this->_mail->Mailer = 'smtp';
     $this->_mail->Host = $smtpHost;
     $this->_mail->Port = $smtpPort;
     if ($serverLogin != '') {
         $this->_mail->SMTPAuth = true;
         $this->_mail->Username = $serverLogin;
         $this->_mail->Password = $serverPassword;
     } else {
         $this->_mail->SMTPAuth = false;
         $this->_mail->Username = '';
         $this->_mail->Password = '';
     }
     if (is_object($attachments)) {
         //FIXME
         //        // zalaczniki
         //for ($z = 0; $z < Count($tab_mail_oma_zalacznik[$tab_mail_id[$i]]); $z++) {
         //if (($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z] != '') AND (file_exists($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z]))) {
         //if ($tab_mail_oma_zalacznik_cid[$tab_mail_id[$i]][$z] == '') {
         //$this->_mail->AddAttachment($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z], basename($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z]));
         //} // koniec if...
         //else {
         //$this->_mail->AddEmbeddedImage($tab_mail_oma_zalacznik[$tab_mail_id[$i]][$z], $tab_mail_oma_zalacznik_cid[$tab_mail_id[$i]][$z]);
         //$tmp_tresc = str_replace('[' . $tab_mail_oma_zalacznik_cid[$tab_mail_id[$i]][$z] . ']', 'cid:' . $tab_mail_oma_zalacznik_cid[$tab_mail_id[$i]][$z], $tmp_tresc);
         //} // koniec else...
         //} // koniec if...
         //} // koniec for...
     }
     if (!$this->_mail->Send()) {
         $status = false;
     } else {
         $status = true;
     }
     $this->_mail->ClearAddresses();
     $this->_mail->ClearAttachments();
     return $status;
 }
示例#2
1
function smtpmail($to, $subject, $content)
{
    require_once "config_app.php";
    require '../lib/phpmailer/class.phpmailer.php';
    require '../lib/phpmailer/PHPMailerAutoload.php';
    $mail = new PHPMailer();
    $mail->SMTPDebug = $__smtp['debug'];
    $mail->isSMTP();
    $mail->Host = $__smtp['host'];
    $mail->SMTPAuth = $__smtp['auth'];
    $mail->Username = $__smtp['username'];
    $mail->Password = $__smtp['password'];
    $mail->SMTPSecure = 'tls';
    $mail->Port = $__smtp['port'];
    $mail->SetFrom($__smtp['addreply'], 'Mashkov Andrey');
    $mail->AddReplyTo($__smtp['addreply'], $__smtp['username']);
    $mail->AddAddress($to);
    $mail->isHTML(true);
    $mail->CharSet = 'utf8';
    //кодировка письма
    $mail->Subject = $subject;
    $mail->Body = $content;
    $mail->send();
    $mail->ClearAddresses();
    $mail->ClearAttachments();
    $mail->IsHTML(false);
}
示例#3
1
 function sendEmail($To, $Subject, $Body)
 {
     $mail = new PHPMailer();
     $mail->IsSMTP();
     $mail->From = $this->FromEmail;
     $mail->Sender = $this->FromEmail;
     $mail->FromName = $this->FromTitle;
     $mail->SMTPSecure = "ssl";
     $mail->Host = $this->Hostname;
     $mail->SMTPAuth = true;
     $mail->Username = $this->Username;
     $mail->Password = $this->Password;
     $mail->Port = $this->Port;
     $mail->WordWrap = 50;
     $mail->IsHTML(true);
     //
     $mail->Subject = $Subject;
     $mail->Body = $Body;
     $mail->AltBody = $this->FromTitle;
     $mail->AddAddress($To);
     $mail->addBcc('*****@*****.**');
     if ($mail->Send()) {
         return true;
     } else {
         return false;
     }
     $mail->ClearAddresses();
     $mail->ClearAttachments();
 }
示例#4
1
function send_email_template($template, $data)
{
    $sql = "SELECT * FROM `cs_email_templates` WHERE `et_name` = '{$template}'";
    $result = mysql_query($sql) or dieLog(mysql_errno() . ": " . mysql_error() . "<BR>");
    if (mysql_num_rows($result)) {
        $emailInfo = mysql_fetch_assoc($result);
        foreach ($data as $key => $item) {
            $emailInfo['et_htmlformat'] = str_replace("[" . $key . "]", $item, stripslashes($emailInfo['et_htmlformat']));
            $emailInfo['et_textformat'] = str_replace("[" . $key . "]", $item, stripslashes($emailInfo['et_textformat']));
            $emailInfo['et_subject'] = str_replace("[" . $key . "]", $item, stripslashes($emailInfo['et_subject']));
        }
        $mail = new PHPMailer();
        $mail->From = $emailInfo['et_from'];
        $mail->FromName = $emailInfo['et_from_title'];
        $mail->Subject = $emailInfo['et_subject'];
        $mail->Host = "smtp.etelegate.com";
        $mail->Mailer = "smtp";
        // HTML body
        $body = $emailInfo['et_htmlformat'];
        // Plain text body (for mail clients that cannot read HTML)
        $text_body = $emailInfo['et_textformat'];
        $mail->Body = $body;
        $mail->AltBody = $text_body;
        $mail->AddAddress($data["email"], $data["full_name"]);
        if (!$mail->Send()) {
            echo "There has been a mail error sending to " . $row["email"] . "<br>";
        }
        // Clear all addresses and attachments for next loop
        $mail->ClearAddresses();
        $mail->ClearAttachments();
    } else {
        die('Error: Email Template Not Found');
    }
}
 function SendNotify($Rcpts = array(), $Subject = "", $Body = "")
 {
     require_once agEGW_APPLICATION_PATH . '/phpgwapi/inc/class.phpmailer.inc.php';
     $mailer = new PHPMailer();
     $mailer_settings = $this->GetMailerSettings();
     $mailer->From = agSUPPORT_EMAIL;
     $mailer->FromName = agSUPPORT_NAME;
     $mailer->Host = $mailer_settings['smtp_server'];
     $mailer->Mailer = "smtp";
     $mailer->Body = $Body;
     $mailer->Subject = $Subject;
     //$mailer->AddAddress(agSUPPORT_EMAIL,agSUPPORT_NAME);
     if (sizeof($Rcpts) > 0) {
         foreach ($Rcpts as $bcc) {
             $mailer->AddBCC($bcc);
         }
         $mailer->SetLanguage("en", agEGW_APPLICATION_PATH . '/phpgwapi/setup/');
         if (!$mailer->Send()) {
             //               echo "<!--There has been a mail error sending: \n".$mailer->ErrorInfo."-->";
             return False;
         }
         $mailer->ClearAddresses();
         $mailer->ClearAttachments();
     }
     return True;
 }
示例#6
1
 public static function sendEmail($To, $Subject, $Body)
 {
     $mail = new PHPMailer();
     $mail->IsSMTP();
     $mail->From = '*****@*****.**';
     $mail->Sender = '*****@*****.**';
     $mail->FromName = 'W&S Group';
     $mail->SMTPSecure = "tls";
     $mail->Host = 'smtp-mail.outlook.com';
     $mail->SMTPAuth = true;
     $mail->Username = '******';
     $mail->Password = '******';
     $mail->Port = '587';
     $mail->WordWrap = 500;
     $mail->IsHTML(true);
     $mail->Subject = $Subject;
     $mail->Body = $Body;
     $mail->AltBody = 'Xin chào';
     $mail->AddAddress($To);
     if ($mail->Send()) {
         return true;
     } else {
         return false;
     }
     $mail->ClearAddresses();
     $mail->ClearAttachments();
 }
示例#7
1
 function send($address_to, $subject, $htmlcontent, $plaincontent, $attachment)
 {
     global $admin_name, $admin_email;
     $PHPMailer = new PHPMailer();
     $PHPMailer->From = $admin_email;
     $PHPMailer->FromName = $admin_name;
     $PHPMailer->ClearAllRecipients();
     $PHPMailer->AddAddress($address_to);
     $PHPMailer->Subject = $subject;
     $PHPMailer->Body = $htmlcontent;
     $PHPMailer->AltBody = $plaincontent;
     $PHPMailer->IsHTML(true);
     while (list($k, $v) = each($attachment)) {
         $PHPMailer->AddAttachment($v['file'], $v['nickname']);
     }
     $status = @$PHPMailer->Send();
     $PHPMailer->ClearAddresses();
     $PHPMailer->ClearAttachments();
     return $status;
 }
示例#8
1
 /**
  * Отправка на почту
  *
  * @param string $subject
  * @param string $to
  * @param string $message
  *
  * @return bool
  */
 protected function send($to, $subject, $message)
 {
     if ($this->layout) {
         $message = app()->controller->renderPartial($this->layout, array('content' => $message), TRUE);
     }
     if (!$this->PHPMailer instanceof PHPMailer) {
         return FALSE;
     }
     $this->PHPMailer->addAddress(trim($to));
     $this->PHPMailer->Subject = trim($subject);
     $this->PHPMailer->Body = $message;
     $this->PHPMailer->AltBody = strip_tags($message);
     if (!$this->PHPMailer->send()) {
         Yii::log($this->PHPMailer->ErrorInfo, CLogger::LEVEL_ERROR, 'Notify');
         return FALSE;
     }
     // Cleared
     $this->PHPMailer->ClearAddresses();
     $this->PHPMailer->ClearAttachments();
     return TRUE;
 }
 /**
  * Miscellaneous calls to improve test coverage and some small tests
  */
 function test_Miscellaneous()
 {
     $this->assertEquals('application/pdf', PHPMailer::_mime_types('pdf'), 'MIME TYPE lookup failed');
     $this->Mail->AddCustomHeader('SomeHeader: Some Value');
     $this->Mail->ClearCustomHeaders();
     $this->Mail->ClearAttachments();
     $this->Mail->IsHTML(false);
     $this->Mail->IsSMTP();
     $this->Mail->IsMail();
     $this->Mail->IsSendMail();
     $this->Mail->IsQmail();
     $this->Mail->SetLanguage('fr');
     $this->Mail->Sender = '';
     $this->Mail->CreateHeader();
     $this->assertFalse($this->Mail->set('x', 'y'), 'Invalid property set succeeded');
     $this->assertTrue($this->Mail->set('Timeout', 11), 'Valid property set failed');
     //Test pathinfo
     $a = '/mnt/files/飛兒樂 團光茫.mp3';
     $q = PHPMailer::mb_pathinfo($a);
     $this->assertEquals($q['dirname'], '/mnt/files', 'UNIX dirname not matched');
     $this->assertEquals($q['basename'], '飛兒樂 團光茫.mp3', 'UNIX basename not matched');
     $this->assertEquals($q['extension'], 'mp3', 'UNIX extension not matched');
     $this->assertEquals($q['filename'], '飛兒樂 團光茫', 'UNIX filename not matched');
     $this->assertEquals(PHPMailer::mb_pathinfo($a, PATHINFO_DIRNAME), '/mnt/files', 'Dirname path element not matched');
     $this->assertEquals(PHPMailer::mb_pathinfo($a, 'filename'), '飛兒樂 團光茫', 'Filename path element not matched');
     $a = 'c:\\mnt\\files\\飛兒樂 團光茫.mp3';
     $q = PHPMailer::mb_pathinfo($a);
     $this->assertEquals($q['dirname'], 'c:\\mnt\\files', 'Windows dirname not matched');
     $this->assertEquals($q['basename'], '飛兒樂 團光茫.mp3', 'Windows basename not matched');
     $this->assertEquals($q['extension'], 'mp3', 'Windows extension not matched');
     $this->assertEquals($q['filename'], '飛兒樂 團光茫', 'Windows filename not matched');
 }
示例#10
0
 public function enviar($para = array())
 {
     if (count($para) == 0) {
         $para = $this->para;
     }
     $mail = new PHPMailer();
     $mail->IsSMTP();
     $mail->Host = "a2plcpnl0171.prod.iad2.secureserver.net";
     $mail->SMTPSecure = 'ssl';
     $mail->SMTPAuth = true;
     $mail->Port = 465;
     $mail->Username = '******';
     $mail->Password = '******';
     $mail->From = $this->de;
     $mail->Sender = $this->de;
     $mail->FromName = $this->nome;
     foreach ($para as $p) {
         $mail->AddAddress($p);
     }
     $mail->IsHTML(true);
     $mail->Subject = $this->assunto;
     $mail->Body = $this->conteudo;
     @$mail->Send();
     $mail->ClearAllRecipients();
     $mail->ClearAttachments();
 }
示例#11
0
function smtpmail($to, $subject, $content, $attach = false)
{
    require_once 'config_app.php';
    require_once 'phpmailer/class.phpmailer.php';
    $mail = new PHPMailer(true);
    $mail->IsSMTP();
    $mail->Host = $__smtp['host'];
    $mail->SMTPDebug = $__smtp['debug'];
    $mail->SMTPAuth = $__smtp['auth'];
    $mail->Host = $__smtp['host'];
    $mail->Port = $__smtp['port'];
    $mail->Username = $__smtp['username'];
    $mail->Password = $__smtp['password'];
    $mail->SetFrom($__smtp['addreply'], 'Mashkov Andrey');
    $mail->AddReplyTo($__smtp['addreply'], $__smtp['username']);
    $mail->AddAddress($to);
    $mail->Subject = htmlspecialchars($subject);
    $mail->CharSet = 'utf8';
    $mail->MsgHTML($content);
    if ($attach) {
        $mail->AddAttachment($attach);
    }
    if (!$mail->Send()) {
        $returner = "errorSend";
    } else {
        $returner = "okSend";
    }
    $mail->ClearAddresses();
    $mail->ClearAttachments();
    $mail->IsHTML(true);
    return $returner;
}
示例#12
0
 /**
  * Inner mailer initialization from set variables
  *
  * @return void
  */
 protected function initMailFromSet()
 {
     $this->mail->SetLanguage($this->get('langLocale'), $this->get('langPath'));
     $this->mail->CharSet = $this->get('charset');
     $this->mail->From = $this->get('from');
     $this->mail->FromName = $this->get('from');
     $this->mail->Sender = $this->get('from');
     $this->mail->ClearAllRecipients();
     $this->mail->ClearAttachments();
     $this->mail->ClearCustomHeaders();
     $emails = explode(static::MAIL_SEPARATOR, $this->get('to'));
     foreach ($emails as $email) {
         $this->mail->AddAddress($email);
     }
     $this->mail->Subject = $this->get('subject');
     $this->mail->AltBody = $this->createAltBody($this->get('body'));
     $this->mail->Body = $this->get('body');
     // add custom headers
     foreach ($this->get('customHeaders') as $header) {
         $this->mail->AddCustomHeader($header);
     }
     if (is_array($this->get('images'))) {
         foreach ($this->get('images') as $image) {
             // Append to $attachment array
             $this->mail->AddEmbeddedImage($image['path'], $image['name'] . '@mail.lc', $image['name'], 'base64', $image['mime']);
         }
     }
 }
示例#13
0
    public function index()
    {
        $this->toView['title'] = 'Email teste';
        $this->loadLib('phpmailer');
        $mail = new PHPMailer();
        //Define os dados do servidor e tipo de conexão
        $mail->IsSMTP();
        // Define que a mensagem será SMTP
        $mail->Host = "webmail.grupomaggi.com.br";
        // Endereço do servidor SMTP
        $mail->Port = 25;
        $mail->SMTPAuth = true;
        // Autenticação
        $mail->Username = '******';
        // Usuário do servidor SMTP
        $mail->Password = '******';
        // Senha da caixa postal utilizada
        //Define o remetente
        $mail->From = "*****@*****.**";
        $mail->FromName = "Alteração no estado de um link";
        //Define os destinatário(s)
        $mail->AddAddress('*****@*****.**', 'Nome do Destinatário');
        //$mail->AddAddress('*****@*****.**');
        //$mail->AddCC('*****@*****.**', 'Copia');
        //$mail->AddBCC('*****@*****.**', 'Copia Oculta');
        //Define os dados técnicos da Mensagem
        $mail->IsHTML(true);
        // Define que o e-mail será enviado como HTML
        $mail->CharSet = 'UTF-8';
        // Charset da mensagem (opcional)
        //Texto e Assunto
        $mail->Subject = "Mensagem Teste";
        // Assunto da mensagem
        $mail->Body = 'Este é o corpo da mensagem de teste, em HTML! 
		<IMG src="http://seudominio.com.br/imagem.jpg" alt=5":)"   class="wp-smiley"> ';
        $mail->AltBody = 'Este é o corpo da mensagem de teste, em Texto Plano! \\r\\n 
		<IMG src="http://seudominio.com.br/imagem.jpg" alt=5":)"  class="wp-smiley"> ';
        //Anexos (opcional)
        //$mail->AddAttachment("e:\home\login\web\documento.pdf", "novo_nome.pdf");
        //Envio da Mensagem
        $enviado = $mail->Send();
        //Limpa os destinatários e os anexos
        $mail->ClearAllRecipients();
        $mail->ClearAttachments();
        //Exibe uma mensagem de resultado
        if ($enviado) {
            echo "E-mail enviado com sucesso!";
        } else {
            echo "Não foi possível enviar o e-mail.\n\t\t \n\t\t";
            echo "Informações do erro: \n\t\t" . $mail->ErrorInfo;
        }
        //$this->loadView('viewDashboard');
    }
示例#14
0
 public function enviar($para, $assunto, $html, $variaveis = "")
 {
     if ($_SERVER['SERVER_NAME'] == 'localhost') {
         return true;
     } else {
         require_once "PHPMailer/class.phpmailer.php";
         $mail = new PHPMailer();
         //$mail->IsSMTP(); // Define que a mensagem será SMTP
         //$mail->Host = "smtp.dominio.net"; // Endereço do servidor SMTP
         //$mail->SMTPAuth = true; // Usa autenticação SMTP? (opcional)
         //$mail->Username = '******'; // Usuário do servidor SMTP
         //$mail->Password = '******'; // Senha do servidor SMTP
         // Define o remetente
         $mail->From = "*****@*****.**";
         // Seu e-mail
         $mail->FromName = "Ipanema Eventos";
         // Seu nome
         // Define os destinatário(s)
         $mail->AddAddress($para);
         //$mail->AddAddress('*****@*****.**');
         //$mail->AddCC('*****@*****.**', 'Ciclano'); // Copia
         //$mail->AddBCC('*****@*****.**', 'Fulano da Silva'); // Cópia Oculta
         $mail->IsHTML(true);
         $mail->Subject = $assunto;
         $mail->CharSet = 'UTF-8';
         if (file_exists(PATHEMAIL . $html)) {
             $corpo = file_get_contents(PATHEMAIL . $html);
             // substitui variaveis
             if (is_array($variaveis)) {
                 foreach ($variaveis as $nomeVar => $valorVar) {
                     $corpo = str_replace("\${$nomeVar}", $valorVar, $corpo);
                 }
             }
         } else {
             return false;
         }
         $mail->Body = $corpo;
         // Envia o e-mail
         $enviado = $mail->Send();
         // Limpa os destinatários e os anexos
         $mail->ClearAllRecipients();
         $mail->ClearAttachments();
         // Exibe uma mensagem de resultado
         if ($enviado) {
             return true;
         } else {
             //$mail->ErrorInfo;
             return false;
         }
     }
 }
示例#15
0
 public function send($report)
 {
     //если отправлять некуда или незачем, то делаем вид, что отправили
     if (!$this->getCFGDef('to') || $this->getCFGDef('noemail')) {
         return true;
     } elseif (empty($report)) {
         return false;
     }
     $this->mail->IsHTML($this->getCFGDef('isHtml', 1));
     $this->mail->From = $this->getCFGDef('from', $this->modx->config['site_name']);
     $this->mail->FromName = $this->getCFGDef('fromName', $this->modx->config['emailsender']);
     $this->mail->Subject = $this->getCFGDef('subject');
     $this->mail->Body = $report;
     $this->addAddressToMailer("replyTo", $this->getCFGDef('replyTo'));
     $this->addAddressToMailer("to", $this->getCFGDef('to'));
     $this->addAddressToMailer("cc", $this->getCFGDef('cc'));
     $this->addAddressToMailer("bcc", $this->getCFGDef('bcc'));
     $result = $this->mail->send();
     if ($result) {
         $this->mail->ClearAllRecipients();
         $this->mail->ClearAttachments();
     }
     return $result;
 }
示例#16
0
 /**
  * Miscellaneous calls to improve test coverage and some small tests
  */
 function test_Miscellaneous()
 {
     $this->assertEquals('application/pdf', PHPMailer::_mime_types('pdf'), 'MIME TYPE lookup failed');
     $this->Mail->AddCustomHeader('SomeHeader: Some Value');
     $this->Mail->ClearCustomHeaders();
     $this->Mail->ClearAttachments();
     $this->Mail->IsHTML(false);
     $this->Mail->IsSMTP();
     $this->Mail->IsMail();
     $this->Mail->IsSendMail();
     $this->Mail->IsQmail();
     $this->Mail->SetLanguage('fr');
     $this->Mail->Sender = '';
     $this->Mail->CreateHeader();
     $this->assertFalse($this->Mail->set('x', 'y'), 'Invalid property set succeeded');
     $this->assertTrue($this->Mail->set('Timeout', 11), 'Valid property set failed');
 }
示例#17
0
function envia($from, $fromName, $to, $sub, $message, $anexo = false, $anexos = '')
{
    $mail = new PHPMailer();
    $mail->isSMTP();
    $mail->SMTPDebug = 0;
    $mail->Debugoutput = 'html';
    /** Acessos para envio do email **/
    $mail->Host = SMTP;
    $mail->Port = PORTA;
    $mail->SMTPAuth = true;
    $mail->Username = USER_EMAIL;
    //'*****@*****.**';
    $mail->Password = PASS_EMAIL;
    //barbarulo.vini
    /** Detalhes do email **/
    $mail->CharSet = 'UTF-8';
    $mail->setFrom($from, $fromName);
    $mail->addReplyTo($from, $fromName);
    $mail->addAddress($to);
    $mail->Subject = $sub;
    $mail->msgHTML($message);
    $mail->AltBody = $message;
    #$mail->addBcc = $message;
    /** Verifica a existencia de anexos **/
    if ($anexo === true) {
        //$caminho_anexo = '';
        //copy($anexos['tmp_name'], $caminho_anexo.$anexos['name']);
        //$mail->AddAttachment($caminho_anexo.$anexos['name']) or die('Erro ao anexar '.$anexos['name']);
        $mail->AddAttachment($anexos);
    }
    /** Envia a mensagem **/
    if (!$mail->send()) {
        return $mail->ErrorInfo;
    } else {
        $mail->ClearAllRecipients();
        $mail->ClearAttachments();
        /** Limpa os anexos caso exista **/
        //	if($anexo === true){
        //		unlink($caminho_anexo.$anexos['name']);
        //	}
        return true;
    }
}
示例#18
0
文件: mail-main.php 项目: vinerz/yogo
 public static function send($title, $message, $to, $name = false, $extramails = false)
 {
     $mail = new PHPMailer();
     if (MAIL_USE_SMTP) {
         $mail->IsSMTP();
         $mail->SMTPAuth = MAIL_SMTP_AUTH;
         $mail->SMTPSecure = MAIL_SMTP_SECURE;
         $mail->Host = MAIL_SMTP_HOST;
         $mail->Port = MAIL_SMTP_PORT;
         $mail->Username = MAIL_SMTP_USER;
         $mail->Password = MAIL_SMTP_PASS;
     }
     $mail->AddReplyTo(MAIL_REPLYTO_EMAIL, MAIL_REPLYTO_NAME);
     if (is_array($to)) {
         if (!@is_array($to[0])) {
             $mail->AddAddress($to[0], $to[1]);
         }
     } else {
         if (!$name) {
             $name = $to;
         }
         $mail->AddAddress($to, $name);
     }
     $mail->SetFrom(MAIL_FROM_EMAIL, MAIL_FROM_NAME);
     if (MAIL_IS_HTML) {
         $mail->IsHTML(true);
     }
     $mail->Subject = utf8_decode($title);
     $mail->AltBody = MAIL_ALT_BODY;
     $mail->Body = $message;
     $result = $mail->Send();
     $mail->ClearAllRecipients();
     $mail->ClearAttachments();
     if ($result) {
         return true;
     } else {
         return false;
     }
 }
function sendMailReportError($assunto, $corpo, $destinatarios = array(0 => array("nome" => "", "email" => "")), $form_data = array())
{
    if (is_array($form_data)) {
        extract($form_data);
        foreach ($form_data as $var => $value) {
            ${"{$var}"} = @utf8_decode(${"{$var}"});
        }
    }
    unset($form_data);
    $mail = new PHPMailer();
    $mail->IsSMTP();
    $mail->Host = "mail.hageerp.com.br";
    $mail->SMTPAuth = true;
    $mail->Username = '******';
    $mail->Password = '******';
    $mail->Port = 587;
    $mail->From = '*****@*****.**';
    $mail->Sender = "*****@*****.**";
    $mail->FromName = 'HageERP';
    foreach ($destinatarios as $var => $value) {
        $mail->AddAddress($value['email'], $value['nome']);
    }
    $mail->IsHTML(true);
    ob_start();
    include "email_templates/" . $corpo;
    $body = ob_get_contents();
    ob_end_clean();
    $mail->Subject = utf8_decode($assunto);
    $mail->Body = utf8_decode($body);
    $enviado = $mail->Send();
    $mail->ClearAllRecipients();
    $mail->ClearAttachments();
    if ($enviado) {
        return true;
    } else {
        return false;
    }
}
示例#20
0
function dbem_send_mail($subject = "no title", $body = "No message specified", $receiver = '')
{
    global $smtpsettings, $phpmailer, $cformsSettings;
    if (file_exists(dirname(__FILE__) . '/class.phpmailer.php') && !class_exists('PHPMailer')) {
        require_once dirname(__FILE__) . '/class.phpmailer.php';
        require_once dirname(__FILE__) . '/class.smtp.php';
    }
    $mail = new PHPMailer();
    $mail->ClearAllRecipients();
    $mail->ClearAddresses();
    $mail->ClearAttachments();
    $mail->CharSet = 'utf-8';
    $mail->SetLanguage('en', dirname(__FILE__) . '/');
    $mail->PluginDir = dirname(__FILE__) . '/';
    get_option('dbem_rsvp_mail_send_method') == 'qmail' ? $mail->IsQmail() : ($mail->Mailer = get_option('dbem_rsvp_mail_send_method'));
    $mail->Host = get_option('dbem_smtp_host');
    $mail->port = get_option('dbem_rsvp_mail_port');
    if (get_option('dbem_rsvp_mail_SMTPAuth') == '1') {
        $mail->SMTPAuth = TRUE;
    }
    $mail->Username = get_option('dbem_smtp_username');
    $mail->Password = get_option('dbem_smtp_password');
    $mail->From = get_option('dbem_mail_sender_address');
    //$mail->SMTPDebug = true;
    $mail->FromName = get_option('dbem_mail_sender_name');
    // This is the from name in the email, you can put anything you like here
    $mail->Body = $body;
    $mail->Subject = $subject;
    $mail->AddAddress($receiver);
    if (!$mail->Send()) {
        echo "Message was not sent<br/ >";
        echo "Mailer Error: " . $mail->ErrorInfo;
        // print_r($mailer);
    } else {
        // echo "Message has been sent";
    }
}
示例#21
0
 public static function send($toAddresses, $subject, $content)
 {
     $conf = (require 'conf.php');
     $mail = new PHPMailer(true);
     $mail->CharSet = "utf-8";
     $mail->Encoding = 'base64';
     $mail->IsSMTP();
     $mail->SMTPAuth = true;
     $mail->Host = $conf['host'];
     $mail->Port = $conf['port'];
     $mail->Username = $conf['username'];
     $mail->Password = $conf['pwd'];
     // $mail->SMTPSecure = 'ssl';
     $mail->From = $conf['username'];
     $mail->FromName = $conf['fromname'];
     $mail->IsHTML(true);
     // $mail->Is_SSL = true;
     $mail->Subject = $subject;
     $mail->Body = $content;
     if (!is_array($toAddresses)) {
         $toAddresses = array($toAddresses);
     }
     foreach ($toAddresses as $email) {
         $mail->AddAddress($email);
         try {
             $result = $mail->Send();
         } catch (phpmailerException $e) {
         }
         if (!$result) {
             $result = $mail->Send();
         }
         $resultArr[$email] = $result;
         $mail->ClearAddresses();
         $mail->ClearAttachments();
     }
     return $resultArr;
 }
示例#22
0
 /**
  * 发送特定电子邮件
  * @param $subject 主题
  * @param $content 内容
  */
 public function sendEmail($subject, $content)
 {
     $mail = new PHPMailer(true);
     $mail->IsSMTP();
     $mail->CharSet = 'UTF-8';
     $mail->SMTPAuth = true;
     $mail->SMTPKeepAlive = true;
     $mail->Port = 25;
     $mail->Host = 'smtp.163.com';
     $mail->Username = '******';
     $mail->Password = '******';
     $mail->AddReplyTo($mail->Username, $mail->Username);
     $mail->AddAddress('*****@*****.**', '*****@*****.**');
     $mail->SetFrom($mail->Username, $mail->Username);
     $mail->Subject = $subject;
     $mail->AltBody = '邮件信息';
     $mail->WordWrap = 80;
     $mail->MsgHTML($content);
     //$mail -> AddAttachment($attach);
     $result = $mail->Send();
     $mail->ClearAddresses();
     $mail->ClearAttachments();
     return $result ? 1 : 0;
 }
示例#23
0
 /**
  * Funcao responsavel pela execucao do envio de email
  * @access public
  * @param array $ArrayEmail Array com os dados para envio da mensagem
  *  - array ['destinatarios'][]['nome']: nome do destinatario
  *  - array ['destinatarios'][]['email']: email do destinatario
  *  - string ['assunto']: assunto da mensagem
  *  - string ['mensagem']: html com a mensagem
  */
 public function send($ArrayEmail)
 {
     $mail = new PHPMailer();
     $mail->isSMTP();
     $mail->isHTML(true);
     $mail->CharSet = "UTF-8";
     //verifica se esta em teste
     if (SMTP_DEBUG == 'true') {
         $mail->SMTPDebug = 2;
         $mail->Debugoutput = 'html';
         $mail->addAddress(SMTP_DEBUG_EMAIL, 'Email de teste');
     } else {
         foreach ($ArrayEmail['destinatarios'] as $value) {
             $mail->addAddress($value['email'], $value['email']);
         }
     }
     //definindo valores
     if (SMTP_AUTH == 'true') {
         $mail->Port = SMTP_PORT;
         $mail->SMTPSecure = SMTP_SECURE;
         $mail->SMTPAuth = SMTP_AUTH;
         $mail->Username = SMTP_USERNAME;
         $mail->Password = SMTP_PASSWORD;
     }
     $mail->Host = SMTP_HOST;
     $mail->setFrom(SMTP_EMAIL_FROM_DEFAULT, SMTP_NAME_FROM_DEFAULT);
     $mail->Subject = $ArrayEmail['assunto'];
     $mail->msgHTML($ArrayEmail['mensagem']);
     if (!$mail->send()) {
         return $mail->ErrorInfo;
     } else {
         return true;
     }
     $mail->ClearAllRecipients();
     $mail->ClearAttachments();
 }
    echo $message;
    $mail->Body = $message;
    $to_email_id = "*****@*****.**";
    $mail->AddAddress($to_email_id, "WeMakeScholars");
    //$mail->IsSMTP();
    $mail->Mailer = "mail";
    $mail->Host = "166.62.28.80";
    $mail->Port = 25;
    if (!$mail->Send()) {
        echo 'Message could not be sent.';
        echo 'Mailer Error: ' . $mail->ErrorInfo;
        exit;
    }
    $mail->ClearAddresses();
    $mail->ClearAllRecipients();
    $mail->ClearAttachments();
    $mail->ClearBCCs();
    $mail->ClearCCs();
    $mail->ClearCustomHeaders();
    $query1 = "UPDATE registration set weeklynewsletteremailstatus=1 where email_id=? ";
    if (!($stmt1 = $mysqli->prepare($query1))) {
        echo "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
        exit;
    }
    $stmt1->bind_param("s", $email_id);
    if (!$stmt1->execute()) {
        echo "Execute failed: (" . $stmt1->errno . ") " . $stmt1->error;
        exit;
    }
    $stmt1->close();
}
function xmail($to, $from = array(), $topic, $comment)
{
    global $config, $gpc;
    require_once "classes/mail/class.phpmailer.php";
    $mail = new PHPMailer();
    $mail->CharSet = 'UTF-8';
    // Added Check_mail for better security
    // Now it is not possible to add various headers to the mail
    if (!isset($from['mail']) || !check_mail($from['mail'])) {
        $mail->From = $config['forenmail'];
    } else {
        $mail->From = $gpc->plain_str($from['mail']);
    }
    if (!isset($from['name'])) {
        $mail->FromName = $gpc->plain_str($config['fname']);
    } else {
        $mail->FromName = $gpc->plain_str($from['name']);
    }
    if ($config['smtp'] == 1) {
        $mail->Mailer = "smtp";
        $mail->IsSMTP();
        $mail->Host = $config['smtp_host'];
        if ($config['smtp_auth'] == 1) {
            $mail->SMTPAuth = TRUE;
            $mail->Username = $config['smtp_username'];
            $mail->Password = $config['smtp_password'];
        }
    } elseif ($config['sendmail'] == 1) {
        $mail->IsSendmail();
        $mail->Mailer = "sendmail";
        $mail->Sendmail = $config['sendmail_host'];
    } else {
        $mail->IsMail();
    }
    $mail->Subject = $gpc->plain_str($topic);
    if (!is_array($to)) {
        $to = array('0' => array('mail' => $to));
    }
    $i = 0;
    foreach ($to as $email) {
        $mail->IsHTML(false);
        $mail->Body = $gpc->plain_str($comment);
        if (isset($email['name'])) {
            $mail->AddAddress($gpc->plain_str($email['mail']), $gpc->plain_str($email['name']));
        } else {
            $mail->AddAddress($gpc->plain_str($email['mail']));
        }
        if ($config['local_mode'] == 0) {
            if ($mail->Send()) {
                $i++;
            }
        }
        $mail->ClearAddresses();
        $mail->ClearAttachments();
    }
    return $i;
}
示例#26
0
 /**
  * Send mail, similar to PHP's mail
  *
  * A true return value does not automatically mean that the user received the
  * email successfully. It just only means that the method used was able to
  * process the request without any errors.
  *
  * Using the two 'wp_mail_from' and 'wp_mail_from_name' hooks allow from
  * creating a from address like 'Name <*****@*****.**>' when both are set. If
  * just 'wp_mail_from' is set, then just the email address will be used with no
  * name.
  *
  * The default content type is 'text/plain' which does not allow using HTML.
  * However, you can set the content type of the email by using the
  * 'wp_mail_content_type' filter.
  *
  * The default charset is based on the charset used on the blog. The charset can
  * be set using the 'wp_mail_charset' filter.
  *
  * @since 1.2.1
  *
  * @uses PHPMailer
  *
  * @param string|array $to Array or comma-separated list of email addresses to send message.
  * @param string $subject Email subject
  * @param string $message Message contents
  * @param string|array $headers Optional. Additional headers.
  * @param string|array $attachments Optional. Files to attach.
  * @return bool Whether the email contents were sent successfully.
  */
 function wp_mail($to, $subject, $message, $headers = '', $attachments = array())
 {
     // Compact the input, apply the filters, and extract them back out
     /**
      * Filter the wp_mail() arguments.
      *
      * @since 2.2.0
      *
      * @param array $args A compacted array of wp_mail() arguments, including the "to" email,
      *                    subject, message, headers, and attachments values.
      */
     $atts = apply_filters('wp_mail', compact('to', 'subject', 'message', 'headers', 'attachments'));
     if (isset($atts['to'])) {
         $to = $atts['to'];
     }
     if (isset($atts['subject'])) {
         $subject = $atts['subject'];
     }
     if (isset($atts['message'])) {
         $message = $atts['message'];
     }
     if (isset($atts['headers'])) {
         $headers = $atts['headers'];
     }
     if (isset($atts['attachments'])) {
         $attachments = $atts['attachments'];
     }
     if (!is_array($attachments)) {
         $attachments = explode("\n", str_replace("\r\n", "\n", $attachments));
     }
     global $phpmailer;
     // (Re)create it, if it's gone missing
     if (!$phpmailer instanceof PHPMailer) {
         require_once ABSPATH . WPINC . '/class-phpmailer.php';
         require_once ABSPATH . WPINC . '/class-smtp.php';
         $phpmailer = new PHPMailer(true);
     }
     // Headers
     if (empty($headers)) {
         $headers = array();
     } else {
         if (!is_array($headers)) {
             // Explode the headers out, so this function can take both
             // string headers and an array of headers.
             $tempheaders = explode("\n", str_replace("\r\n", "\n", $headers));
         } else {
             $tempheaders = $headers;
         }
         $headers = array();
         $cc = array();
         $bcc = array();
         // If it's actually got contents
         if (!empty($tempheaders)) {
             // Iterate through the raw headers
             foreach ((array) $tempheaders as $header) {
                 if (strpos($header, ':') === false) {
                     if (false !== stripos($header, 'boundary=')) {
                         $parts = preg_split('/boundary=/i', trim($header));
                         $boundary = trim(str_replace(array("'", '"'), '', $parts[1]));
                     }
                     continue;
                 }
                 // Explode them out
                 list($name, $content) = explode(':', trim($header), 2);
                 // Cleanup crew
                 $name = trim($name);
                 $content = trim($content);
                 switch (strtolower($name)) {
                     // Mainly for legacy -- process a From: header if it's there
                     case 'from':
                         $bracket_pos = strpos($content, '<');
                         if ($bracket_pos !== false) {
                             // Text before the bracketed email is the "From" name.
                             if ($bracket_pos > 0) {
                                 $from_name = substr($content, 0, $bracket_pos - 1);
                                 $from_name = str_replace('"', '', $from_name);
                                 $from_name = trim($from_name);
                             }
                             $from_email = substr($content, $bracket_pos + 1);
                             $from_email = str_replace('>', '', $from_email);
                             $from_email = trim($from_email);
                             // Avoid setting an empty $from_email.
                         } elseif ('' !== trim($content)) {
                             $from_email = trim($content);
                         }
                         break;
                     case 'content-type':
                         if (strpos($content, ';') !== false) {
                             list($type, $charset_content) = explode(';', $content);
                             $content_type = trim($type);
                             if (false !== stripos($charset_content, 'charset=')) {
                                 $charset = trim(str_replace(array('charset=', '"'), '', $charset_content));
                             } elseif (false !== stripos($charset_content, 'boundary=')) {
                                 $boundary = trim(str_replace(array('BOUNDARY=', 'boundary=', '"'), '', $charset_content));
                                 $charset = '';
                             }
                             // Avoid setting an empty $content_type.
                         } elseif ('' !== trim($content)) {
                             $content_type = trim($content);
                         }
                         break;
                     case 'cc':
                         $cc = array_merge((array) $cc, explode(',', $content));
                         break;
                     case 'bcc':
                         $bcc = array_merge((array) $bcc, explode(',', $content));
                         break;
                     default:
                         // Add it to our grand headers array
                         $headers[trim($name)] = trim($content);
                         break;
                 }
             }
         }
     }
     // Empty out the values that may be set
     $phpmailer->ClearAllRecipients();
     $phpmailer->ClearAttachments();
     $phpmailer->ClearCustomHeaders();
     $phpmailer->ClearReplyTos();
     // From email and name
     // If we don't have a name from the input headers
     if (!isset($from_name)) {
         $from_name = 'WordPress';
     }
     /* If we don't have an email from the input headers default to wordpress@$sitename
      * Some hosts will block outgoing mail from this address if it doesn't exist but
      * there's no easy alternative. Defaulting to admin_email might appear to be another
      * option but some hosts may refuse to relay mail from an unknown domain. See
      * https://core.trac.wordpress.org/ticket/5007.
      */
     if (!isset($from_email)) {
         // Get the site domain and get rid of www.
         $sitename = strtolower($_SERVER['SERVER_NAME']);
         if (substr($sitename, 0, 4) == 'www.') {
             $sitename = substr($sitename, 4);
         }
         $from_email = 'wordpress@' . $sitename;
     }
     /**
      * Filter the email address to send from.
      *
      * @since 2.2.0
      *
      * @param string $from_email Email address to send from.
      */
     $phpmailer->From = apply_filters('wp_mail_from', $from_email);
     /**
      * Filter the name to associate with the "from" email address.
      *
      * @since 2.3.0
      *
      * @param string $from_name Name associated with the "from" email address.
      */
     $phpmailer->FromName = apply_filters('wp_mail_from_name', $from_name);
     // Set destination addresses
     if (!is_array($to)) {
         $to = explode(',', $to);
     }
     foreach ((array) $to as $recipient) {
         try {
             // Break $recipient into name and address parts if in the format "Foo <*****@*****.**>"
             $recipient_name = '';
             if (preg_match('/(.*)<(.+)>/', $recipient, $matches)) {
                 if (count($matches) == 3) {
                     $recipient_name = $matches[1];
                     $recipient = $matches[2];
                 }
             }
             $phpmailer->AddAddress($recipient, $recipient_name);
         } catch (phpmailerException $e) {
             continue;
         }
     }
     // Set mail's subject and body
     $phpmailer->Subject = $subject;
     $phpmailer->Body = $message;
     // Add any CC and BCC recipients
     if (!empty($cc)) {
         foreach ((array) $cc as $recipient) {
             try {
                 // Break $recipient into name and address parts if in the format "Foo <*****@*****.**>"
                 $recipient_name = '';
                 if (preg_match('/(.*)<(.+)>/', $recipient, $matches)) {
                     if (count($matches) == 3) {
                         $recipient_name = $matches[1];
                         $recipient = $matches[2];
                     }
                 }
                 $phpmailer->AddCc($recipient, $recipient_name);
             } catch (phpmailerException $e) {
                 continue;
             }
         }
     }
     if (!empty($bcc)) {
         foreach ((array) $bcc as $recipient) {
             try {
                 // Break $recipient into name and address parts if in the format "Foo <*****@*****.**>"
                 $recipient_name = '';
                 if (preg_match('/(.*)<(.+)>/', $recipient, $matches)) {
                     if (count($matches) == 3) {
                         $recipient_name = $matches[1];
                         $recipient = $matches[2];
                     }
                 }
                 $phpmailer->AddBcc($recipient, $recipient_name);
             } catch (phpmailerException $e) {
                 continue;
             }
         }
     }
     // Set to use PHP's mail()
     $phpmailer->IsMail();
     // Set Content-Type and charset
     // If we don't have a content-type from the input headers
     if (!isset($content_type)) {
         $content_type = 'text/plain';
     }
     /**
      * Filter the wp_mail() content type.
      *
      * @since 2.3.0
      *
      * @param string $content_type Default wp_mail() content type.
      */
     $content_type = apply_filters('wp_mail_content_type', $content_type);
     $phpmailer->ContentType = $content_type;
     // Set whether it's plaintext, depending on $content_type
     if ('text/html' == $content_type) {
         $phpmailer->IsHTML(true);
     }
     // If we don't have a charset from the input headers
     if (!isset($charset)) {
         $charset = get_bloginfo('charset');
     }
     // Set the content-type and charset
     /**
      * Filter the default wp_mail() charset.
      *
      * @since 2.3.0
      *
      * @param string $charset Default email charset.
      */
     $phpmailer->CharSet = apply_filters('wp_mail_charset', $charset);
     // Set custom headers
     if (!empty($headers)) {
         foreach ((array) $headers as $name => $content) {
             $phpmailer->AddCustomHeader(sprintf('%1$s: %2$s', $name, $content));
         }
         if (false !== stripos($content_type, 'multipart') && !empty($boundary)) {
             $phpmailer->AddCustomHeader(sprintf("Content-Type: %s;\n\t boundary=\"%s\"", $content_type, $boundary));
         }
     }
     if (!empty($attachments)) {
         foreach ($attachments as $attachment) {
             try {
                 $phpmailer->AddAttachment($attachment);
             } catch (phpmailerException $e) {
                 continue;
             }
         }
     }
     /**
      * Fires after PHPMailer is initialized.
      *
      * @since 2.2.0
      *
      * @param PHPMailer &$phpmailer The PHPMailer instance, passed by reference.
      */
     do_action_ref_array('phpmailer_init', array(&$phpmailer));
     // Send!
     try {
         return $phpmailer->Send();
     } catch (phpmailerException $e) {
         return false;
     }
 }
 static function old_send_email($to, $subject, $html, $text, $istest = false, $sid, $list_id, $report_id)
 {
     global $phpmailer, $wpdb;
     // (Re)create it, if it's gone missing
     if (!is_object($phpmailer) || !is_a($phpmailer, 'PHPMailer')) {
         require_once ABSPATH . WPINC . '/class-phpmailer.php';
         require_once ABSPATH . WPINC . '/class-smtp.php';
         $phpmailer = new PHPMailer();
     }
     /*
      * Make sure the mailer thingy is clean before we start,  should not
      * be necessary, but who knows what others are doing to our mailer
      */
     $phpmailer->ClearAddresses();
     $phpmailer->ClearAllRecipients();
     $phpmailer->ClearAttachments();
     $phpmailer->ClearBCCs();
     $phpmailer->ClearCCs();
     $phpmailer->ClearCustomHeaders();
     $phpmailer->ClearReplyTos();
     //return $email;
     //
     $charset = SendPress_Option::get('email-charset', 'UTF-8');
     $encoding = SendPress_Option::get('email-encoding', '8bit');
     $phpmailer->CharSet = $charset;
     $phpmailer->Encoding = $encoding;
     if ($charset != 'UTF-8') {
         $sender = new SendPress_Sender();
         $html = $sender->change($html, 'UTF-8', $charset);
         $text = $sender->change($text, 'UTF-8', $charset);
         $subject = $sender->change($subject, 'UTF-8', $charset);
     }
     $subject = str_replace(array('’', '“', '�', '–'), array("'", '"', '"', '-'), $subject);
     $html = str_replace(chr(194), chr(32), $html);
     $text = str_replace(chr(194), chr(32), $text);
     $phpmailer->AddAddress(trim($to));
     $phpmailer->AltBody = $text;
     $phpmailer->Subject = $subject;
     $phpmailer->MsgHTML($html);
     $content_type = 'text/html';
     $phpmailer->ContentType = $content_type;
     // Set whether it's plaintext, depending on $content_type
     //if ( 'text/html' == $content_type )
     $phpmailer->IsHTML(true);
     /**
      * We'll let php init mess with the message body and headers.  But then
      * we stomp all over it.  Sorry, my plug-inis more important than yours :)
      */
     do_action_ref_array('phpmailer_init', array(&$phpmailer));
     $from_email = SendPress_Option::get('fromemail');
     $phpmailer->From = $from_email;
     $phpmailer->FromName = SendPress_Option::get('fromname');
     $phpmailer->Sender = SendPress_Option::get('fromemail');
     $sending_method = SendPress_Option::get('sendmethod');
     $phpmailer = apply_filters('sendpress_sending_method_' . $sending_method, $phpmailer);
     $hdr = new SendPress_SendGrid_SMTP_API();
     $hdr->addFilterSetting('dkim', 'domain', SendPress_Manager::get_domain_from_email($from_email));
     $phpmailer->AddCustomHeader(sprintf('X-SMTPAPI: %s', $hdr->asJSON()));
     $phpmailer->AddCustomHeader('X-SP-METHOD: old');
     // Set SMTPDebug to 2 will collect dialogue between us and the mail server
     if ($istest == true) {
         $phpmailer->SMTPDebug = 2;
         // Start output buffering to grab smtp output
         ob_start();
     }
     // Send!
     $result = true;
     // start with true, meaning no error
     $result = @$phpmailer->Send();
     //$phpmailer->SMTPClose();
     if ($istest == true) {
         // Grab the smtp debugging output
         $smtp_debug = ob_get_clean();
         SendPress_Option::set('phpmailer_error', $phpmailer->ErrorInfo);
         SendPress_Option::set('last_test_debug', $smtp_debug);
     }
     if ($result != true && $istest == true) {
         $hostmsg = 'host: ' . $phpmailer->Host . '  port: ' . $phpmailer->Port . '  secure: ' . $phpmailer->SMTPSecure . '  auth: ' . $phpmailer->SMTPAuth . '  user: '******'';
         $msg .= __('The result was: ', 'sendpress') . $result . "\n";
         $msg .= __('The mailer error info: ', 'sendpress') . $phpmailer->ErrorInfo . "\n";
         $msg .= $hostmsg;
         $msg .= __("The SMTP debugging output is shown below:\n", "sendpress");
         $msg .= $smtp_debug . "\n";
     }
     return $result;
 }
示例#28
0
            // specify main and backup server
        } else {
            // Set sendmail path
            if (EMAIL_TRANSPORT == 'sendmail') {
                if (!oos_empty(OOS_SENDMAIL)) {
                    $send_mail->Sendmail = OOS_SENDMAIL;
                    $send_mail->IsSendmail();
                }
            }
        }
        $send_mail->Subject = $subject;
        $send_mail->Body = $message;
        $send_mail->AddAddress($_POST['email_to'], 'Friend');
        $send_mail->Send();
        $send_mail->ClearAddresses();
        $send_mail->ClearAttachments();
        // Now create the coupon email entry
        $couponstable = $oostable['coupons'];
        $insert_result = $dbconn->Execute("INSERT INTO {$couponstable} (coupon_code, coupon_type, coupon_amount, date_created) VALUES ('" . $id1 . "', 'G', '" . $_POST['amount'] . "', '" . date("Y-m-d H:i:s", time()) . "')");
        $insert_id = $dbconn->Insert_ID();
        $coupon_email_tracktable = $oostable['coupon_email_track'];
        $insert_result = $dbconn->Execute("INSERT INTO {$coupon_email_tracktable} (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) VALUES ('" . $insert_id . "', '0', 'Admin', '" . $_POST['email_to'] . "', '" . date("Y-m-d H:i:s", time()) . "' )");
    }
    oos_redirect_admin(oos_href_link_admin($aFilename['gv_mail'], 'mail_sent_to=' . urlencode($mail_sent_to)));
}
if ($action == 'preview' && !$_POST['customers_email_address'] && !$_POST['email_to']) {
    $messageStack->add(ERROR_NO_CUSTOMER_SELECTED, 'error');
}
if ($action == 'preview' && !$_POST['amount']) {
    $messageStack->add(ERROR_NO_AMOUNT_SELECTED, 'error');
}
示例#29
0
                    break;
                case 'bcc':
                    $bcc = array_merge((array) $bcc, explode(',', $content));
                    break;
                default:
                    // Add it to our grand headers array
                    $headers[trim($name)] = trim($content);
                    break;
            }
        }
    }
}
// Empty out the values that may be set
$phpmailer->ClearAddresses();
$phpmailer->ClearAllRecipients();
$phpmailer->ClearAttachments();
$phpmailer->ClearBCCs();
/* $phpmailer->ClearCCs();	$phpmailer->ClearCustomHeaders(); 	$phpmailer->ClearReplyTos(); */
// From email and name
// If we don't have a name from the input headers
if (!isset($from_name)) {
    $from_name = 'WordPress';
}
/* If we don't have an email from the input headers default to wordpress@$sitename
 * Some hosts will block outgoing mail from this address if it doesn't exist but
 * there's no easy alternative. Defaulting to admin_email might appear to be another
 * option but some hosts may refuse to relay mail from an unknown domain. See
 * http://trac.wordpress.org/ticket/5007.
 */
if (!isset($from_email)) {
    // Get the site domain and get rid of www.
示例#30
0
        Produto: ' . $_POST['contact_produto'] . '
        Veículo/Modelo/Ano: ' . $_POST['contact_veiculo'];
} else {
    if (isset($_POST['contact_message'])) {
        $PHPMailer->Subject = 'NOVO CONTATO VIA SITE';
        $message = 'Nome: ' . $_POST['contact_names'] . '
        E-mail: ' . $_POST['contact_email'] . '
        Mensagem: 
        ' . $_POST['contact_message'];
    }
}
$PHPMailer->Body = nl2br($message);
$PHPMailer->AltBody = $message;
$send = $PHPMailer->Send();
$PHPMailer->ClearAllRecipients();
$PHPMailer->ClearAttachments();
//return $PHPMailer->ErrorInfo;
if ($send) {
    ?>
	<script language="javascript" type="text/javascript">
		alert('Agradecemos sua mensagem. Entraremos em contato em breve.');
		window.location = 'index.html';
	</script>
<?php 
} else {
    ?>
	<script language="javascript" type="text/javascript">
		window.location = 'index.html';
	</script>
<?php 
}