当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPMailer::addCustomHeader方法代码示例

本文整理汇总了PHP中PHPMailer::addCustomHeader方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPMailer::addCustomHeader方法的具体用法?PHP PHPMailer::addCustomHeader怎么用?PHP PHPMailer::addCustomHeader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPMailer的用法示例。


在下文中一共展示了PHPMailer::addCustomHeader方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initMailFromSet

 /**
  * 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('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']);
         }
     }
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:33,代码来源:Mailer.php

示例2: _emailascalendar

 /**
  * 
  * @param type $options
  * @return string
  */
 public static function _emailascalendar($options = array())
 {
     require_once 'PHPMailerAutoload.php';
     $options['fromEmail'] = !empty($options['fromEmail']) ? $options['fromEmail'] : SUPERADMIN_EMAIL;
     $options['fromName'] = !empty($options['fromName']) ? $options['fromName'] : DONOTREPLYNAME;
     try {
         $mail = new PHPMailer();
         $mail->isSMTP();
         $mail->SMTPDebug = 0;
         $mail->SMTPAuth = true;
         $mail->Username = MAIL_USERNAME;
         $mail->Password = MAIL_PASSWORD;
         $mail->SMTPSecure = MAIL_TLS;
         $mail->Host = MAIL_SMTP;
         $mail->Port = MAIL_PORT;
         $mail->IsHTML(true);
         $mail->setFrom($options['fromEmail']);
         $mail->addReplyTo($options['fromEmail']);
         $mail->addAddress($options['toEmail']);
         $mail->ContentType = 'text/calendar';
         $mail->Subject = $options['subject'];
         //Create Email Headers
         /* $mime_boundary = "----Meeting Booking----" . MD5(TIME());
            $headers = "From: " . $options['fromEmail'] . " <" . $options['fromEmail'] . ">\n";
            $headers .= "Reply-To: " . $options['fromEmail'] . " <" . $options['fromEmail'] . ">\n";
            $headers .= "MIME-Version: 1.0\n";
            $headers .= "Content-Type: multipart/alternative; boundary=\"$mime_boundary\"\n";
            $headers .= "Content-class: urn:content-classes:calendarmessage\n";
            $mail->addCustomHeader($headers); */
         $mail->addCustomHeader('MIME-version', "1.0");
         $mail->addCustomHeader('Content-type', "text/calendar; method=REQUEST; charset=UTF-8");
         $mail->addCustomHeader('From', $options['fromEmail']);
         $mail->addCustomHeader('Reply-To', $options['fromEmail']);
         $mail->addCustomHeader('Content-Transfer-Encoding', "8bit");
         $mail->addCustomHeader('X-Mailer', "Microsoft Office Outlook 10.0");
         $mail->addCustomHeader("Content-class: urn:content-classes:calendarmessage");
         $mail->Body = $options['message'];
         //$mail->Ical = $options['ical'];
         if (!$mail->Send()) {
             $expError = $mail->ErrorInfo;
             $a = 'error';
         } else {
             //echo "Message has been sent";
             $a = 'true';
         }
     } catch (phpmailerException $e) {
         $expError = $e->errorMessage();
         $a = 'error';
     }
     return $a;
 }
开发者ID:uskumar33,项目名称:DeltaONE,代码行数:56,代码来源:Mail.php

示例3: send

 public function send($email, $to, $body, $subject, $local = false)
 {
     $mail = new \PHPMailer();
     $mail->isSMTP();
     $mail->isHTML(true);
     $mail->CharSet = 'UTF-8';
     $mail->From = 'maillist@vidal.ru';
     $mail->FromName = 'Портал «Vidal.ru»';
     $mail->Subject = $subject;
     $mail->Host = '127.0.0.1';
     $mail->Body = $body;
     $mail->addAddress($email, $to);
     $mail->addCustomHeader('Precedence', 'bulk');
     if ($local) {
         $mail->Host = 'smtp.yandex.ru';
         $mail->From = 'binacy@yandex.ru';
         $mail->SMTPSecure = 'ssl';
         $mail->Port = 465;
         $mail->SMTPAuth = true;
         $mail->Username = 'binacy@yandex.ru';
         $mail->Password = 'oijoijoij';
     }
     $result = $mail->send();
     $mail = null;
     return $result;
 }
开发者ID:Evrika,项目名称:Vidal,代码行数:26,代码来源:PCommand.php

示例4: testMiscellaneous

 /**
  * Miscellaneous calls to improve test coverage and some small tests.
  */
 public function testMiscellaneous()
 {
     $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');
 }
开发者ID:ahmedash95,项目名称:Lily,代码行数:35,代码来源:phpmailerTest.php

示例5: testCustomHeaderGetter

 /**
  * Tests the Custom header getter
  */
 public function testCustomHeaderGetter()
 {
     $this->Mail->addCustomHeader('foo', 'bar');
     $this->assertEquals([['foo', 'bar']], $this->Mail->getCustomHeaders());
     $this->Mail->addCustomHeader('foo', 'baz');
     $this->assertEquals([['foo', 'bar'], ['foo', 'baz']], $this->Mail->getCustomHeaders());
     $this->Mail->clearCustomHeaders();
     $this->assertEmpty($this->Mail->getCustomHeaders());
     $this->Mail->addCustomHeader('yux');
     $this->assertEquals([['yux']], $this->Mail->getCustomHeaders());
     $this->Mail->addCustomHeader('Content-Type: application/json');
     $this->assertEquals([['yux'], ['Content-Type', ' application/json']], $this->Mail->getCustomHeaders());
 }
开发者ID:jbs321,项目名称:portfolio,代码行数:16,代码来源:phpmailerTest.php

示例6: addCustomHeader

 /**
  * Extended AddCustomHeader function in order to stop duplicate 
  * message-ids
  * http://tracker.moodle.org/browse/MDL-3681
  */
 public function addCustomHeader($custom_header, $value = null)
 {
     if ($value === null and preg_match('/message-id:(.*)/i', $custom_header, $matches)) {
         $this->MessageID = $matches[1];
         return true;
     } else {
         if ($value !== null and strcasecmp($custom_header, 'message-id') === 0) {
             $this->MessageID = $value;
             return true;
         } else {
             return parent::addCustomHeader($custom_header, $value);
         }
     }
 }
开发者ID:educacionbe,项目名称:cursos,代码行数:19,代码来源:moodle_phpmailer.php

示例7: send

 public function send($email, $to, $body, $subject)
 {
     $mail = new \PHPMailer();
     $mail->isSMTP();
     $mail->isHTML(true);
     $mail->CharSet = 'UTF-8';
     $mail->From = 'noreply@evrika.ru';
     $mail->FromName = 'Портал «Evrika.ru»';
     $mail->Subject = $subject;
     $mail->Host = '127.0.0.1';
     $mail->Body = $body;
     $mail->addAddress($email, $to);
     $mail->addCustomHeader('Precedence', 'bulk');
     $result = $mail->send();
     $mail = null;
     return $result;
 }
开发者ID:Quiss,项目名称:Evrika,代码行数:17,代码来源:TestCommand.php

示例8: send

 public function send($emails, $template, $subject = 'Уведомление')
 {
     $mail = new \PHPMailer();
     $portal = 'НКЦ ОАО "РЖД"';
     $mail->isSMTP();
     $mail->isHTML(true);
     $mail->CharSet = 'UTF-8';
     $mail->FromName = $portal;
     $mail->Subject = $subject;
     $mail->Host = '127.0.0.1';
     $mail->From = 'noreply@rzd.evrika.ru';
     if ($this->container->getParameter('kernel.environment') == 'dev') {
         $mail->Host = 'smtp.gmail.com';
         $mail->From = 'binacy@gmail.com';
         $mail->SMTPSecure = 'ssl';
         $mail->Port = 465;
         $mail->SMTPAuth = true;
         $mail->Username = 'binacy@gmail.com';
         $mail->Password = '2q32q3q2';
     }
     # устанавливаем содержимое письма
     $templateParams = array('portal' => $portal);
     if (is_string($template)) {
         $templateName = $template;
     } else {
         $templateName = $template[0];
         $templateParams = array_merge($templateParams, $template[1]);
     }
     $mail->addCustomHeader('List-id', $templateName);
     $mail->Body = $this->templating->render($templateName, $templateParams);
     # устанавливаем получателя(ей) письма
     if (is_string($emails)) {
         $mail->addAddress($emails);
     } else {
         foreach ($emails as $email) {
             $mail->addAddress($email);
         }
     }
     # если в настройках мы установили флажок тестирования (не отправлять)
     if ($this->container->hasParameter('no_email')) {
         return;
     }
     $mail->send();
 }
开发者ID:Quiss,项目名称:rzd,代码行数:44,代码来源:EmailService.php

示例9: start

function start()
{
    global $fromname, $fromemail, $subject, $replyto, $attachment, $encode, $contenttype, $encodeheaders, $optout, $xmailer, $maillist, $letter;
    set_time_limit(0);
    if ($handle = @fopen(@$maillist['tmp_name'], "r")) {
        $i = 1;
        while (!feof($handle)) {
            $to = trim(fgets($handle));
            if ($to !== '') {
                $mail = new PHPMailer();
                $mail->XMailer = $xmailer;
                $mail->IsHtml($contenttype === 'html');
                $mail->CharSet = "UTF-8";
                $mail->Encoding = $encode;
                $mail->From = $fromemail;
                $mail->FromName = $fromname;
                fwrite(fopen('out.txt', 'a'), "{$to}\n");
                $mail->AddAddress($to);
                $mail->Subject = $subject;
                $mail->Body = $letter;
                if ($replyto) {
                    $mail->AddReplyTo($replyto);
                }
                if (@count(@$attachment) > 0) {
                    $mail->AddAttachment($attachment['tmp_name']);
                }
                if ($optout !== '') {
                    $mail->addCustomHeader('List-Unsubscribe', '<mailto:' . md5($to) . $optout . '>');
                }
                print $i++ . "\t\t: [" . ($mail->Send() ? '+' : '-') . "] : {$to}\n";
                ob_flush();
                flush();
            }
        }
        fclose($handle);
    }
}
开发者ID:x-extr,项目名称:Php_Mailer_Inbox,代码行数:37,代码来源:index.php

示例10: send

 public function send($email, $to, $body, $subject, $local = false)
 {
     $mail = new \PHPMailer();
     $mail->isSMTP();
     $mail->isHTML(true);
     $mail->CharSet = 'UTF-8';
     $mail->From = 'noreply@evrika.ru';
     $mail->FromName = 'Портал ЦНМО.РФ';
     $mail->Subject = $subject;
     $mail->Host = '127.0.0.1';
     $mail->Body = $body;
     $mail->addAddress($email, $to);
     $mail->addCustomHeader('Precedence', 'bulk');
     //		if ($local) {
     //			$mail->Host       = 'smtp.yandex.ru';
     //			$mail->From       = 'binacy@ysendandex.ru';
     //			$mail->SMTPSecure = 'ssl';
     //			$mail->Port       = 465;
     //			$mail->SMTPAuth   = true;
     //			$mail->Username   = 'binacy@yandex.ru';
     //			$mail->Password   = 'oijoijoij';
     //		}
     return $mail->send() ? null : $mail->ErrorInfo;
 }
开发者ID:Quiss,项目名称:cnmo,代码行数:24,代码来源:MailCommand.php

示例11: sendQueue

 function sendQueue($pQueueMixed)
 {
     global $gBitSmarty, $gBitSystem, $gBitLanguage;
     static $body = array();
     if (is_array($pQueueMixed)) {
         $pick = $pQueueMixed;
     } elseif (is_numeric($pQueueMixed)) {
         $pick = $this->mDb->GetRow("SELECT * FROM `" . BIT_DB_PREFIX . "mail_queue` mq WHERE `mail_queue_id` = ? " . $this->mDb->SQLForUpdate(), array($pQueueMixed));
     }
     if (!empty($pick)) {
         $startTime = microtime(TRUE);
         $this->mDb->query("UPDATE `" . BIT_DB_PREFIX . "mail_queue` SET `begin_date`=? WHERE `mail_queue_id` = ? ", array(time(), $pick['mail_queue_id']));
         if (!empty($pick['user_id'])) {
             $userHash = $this->mDb->getRow("SELECT * FROM `" . BIT_DB_PREFIX . "users_users` WHERE `user_id`=?", array($pick['user_id']));
             $pick['full_name'] = BitUser::getDisplayName(FALSE, $userHash);
         } else {
             $pick['full_name'] = NULL;
         }
         if (!isset($body[$pick['content_id']])) {
             $gBitSmarty->assign('sending', TRUE);
             // We only support sending of newsletters currently
             $content = new BitNewsletterEdition(NULL, $pick['content_id']);
             if ($content->load()) {
                 $body[$pick['content_id']]['body'] = $content->render();
                 $body[$pick['content_id']]['subject'] = $content->getTitle();
                 $body[$pick['content_id']]['reply_to'] = $content->getField('reply_to', $gBitSystem->getConfig('site_sender_email', $_SERVER['SERVER_ADMIN']));
                 $body[$pick['content_id']]['object'] = $content;
             } else {
                 bit_error_log($this->mErrors);
             }
             //				$content[$pick['content_id']] = LibertyBase::getLibertyObject();
         }
         print "[ {$pick['mail_queue_id']} ] {$pick['content_id']} TO: {$pick['email']}\t";
         $unsub = $this->getUnsubscription($pick['email'], $pick['nl_content_id']);
         if (!empty($unsub)) {
             print " SKIPPED (unsubscribed) <br/>\n";
             $this->mDb->query("DELETE FROM `" . BIT_DB_PREFIX . "mail_queue` WHERE `mail_queue_id`=?", array($pick['mail_queue_id']));
         } elseif (!empty($body[$pick['content_id']])) {
             $pick['url_code'] = md5($pick['content_id'] . $pick['email'] . $pick['queue_date']);
             $unsub = '';
             if ($body[$pick['content_id']]['object']->mNewsletter->getField('unsub_msg')) {
                 $gBitSmarty->assign('url_code', $pick['url_code']);
             }
             $gBitSystem->preDisplay('');
             $gBitSmarty->assign('sending', TRUE);
             $gBitSmarty->assign('unsubMessage', $unsub);
             $gBitSmarty->assign('trackCode', $pick['url_code']);
             $gBitSmarty->assign('mid', 'bitpackage:newsletters/view_edition.tpl');
             $htmlBody = $gBitSmarty->fetch('bitpackage:newsletters/mail_edition.tpl');
             $htmlBody = bit_add_clickthrough($htmlBody, $pick['url_code']);
             $mailer = new PHPMailer();
             if ($gBitSystem->getConfig('bitmailer_errors_to')) {
                 $mailer->Sender = $gBitSystem->getConfig('bitmailer_errors_to');
                 $mailer->addCustomHeader("Errors-To: " . $gBitSystem->getConfig('bitmailer_errors_to'));
             }
             $mailer->From = $gBitSystem->getConfig('bitmailer_sender_email', $gBitSystem->getConfig('site_sender_email', $_SERVER['SERVER_ADMIN']));
             $mailer->FromName = $gBitSystem->getConfig('bitmailer_from', $gBitSystem->getConfig('site_title'));
             $mailer->Host = $gBitSystem->getConfig('bitmailer_servers', $gBitSystem->getConfig('kernel_server_name', '127.0.0.1'));
             $mailer->Mailer = $gBitSystem->getConfig('bitmailer_protocol', 'smtp');
             // Alternative to IsSMTP()
             $mailer->CharSet = 'UTF-8';
             if ($gBitSystem->getConfig('bitmailer_smtp_username')) {
                 $mailer->SMTPAuth = TRUE;
                 $mailer->Username = $gBitSystem->getConfig('bitmailer_smtp_username');
             }
             if ($gBitSystem->getConfig('bitmailer_smtp_password')) {
                 $mailer->Password = $gBitSystem->getConfig('bitmailer_smtp_password');
             }
             $mailer->WordWrap = $gBitSystem->getConfig('bitmailer_word_wrap', 75);
             if (!$mailer->SetLanguage($gBitLanguage->getLanguage(), UTIL_PKG_PATH . 'phpmailer/language/')) {
                 $mailer->SetLanguage('en');
             }
             $mailer->ClearReplyTos();
             $mailer->AddReplyTo($body[$pick['content_id']]['reply_to'], $gBitSystem->getConfig('bitmailer_from'));
             $mailer->Body = $htmlBody;
             $mailer->Subject = $body[$pick['content_id']]['subject'];
             $mailer->IsHTML(TRUE);
             $mailer->AltBody = '';
             $mailer->AddAddress($pick['email'], $pick["full_name"]);
             if ($mailer->Send()) {
                 print " SENT " . round(microtime(TRUE) - $startTime, 2) . " secs<br/>\n";
                 flush();
                 $updateQuery = "UPDATE `" . BIT_DB_PREFIX . "mail_queue` SET `sent_date`=?,`url_code`=?  WHERE `content_id`=? AND `email`=?";
                 $this->mDb->query($updateQuery, array(time(), $pick['url_code'], $pick['content_id'], $pick['email']));
             } else {
                 $updateQuery = "UPDATE `" . BIT_DB_PREFIX . "mail_queue` SET `mail_error`=?,`sent_date`=?  WHERE `content_id`=? AND `email`=?";
                 $this->mDb->query($updateQuery, array($mailer->ErrorInfo, time(), $pick['content_id'], $pick['email']));
                 $pick['error'] = $mailer->ErrorInfo;
                 $this->logError($pick);
             }
         }
     }
 }
开发者ID:bitweaver,项目名称:newsletters,代码行数:93,代码来源:BitNewsletterMailer.php

示例12: function

     $body .= "Si cet e-mail ne s'affiche pas correctement, veuillez <a href='" . $row_config_globale['base_url'] . $row_config_globale['path'] . "online.php?i={$msg_id}&list_id={$list_id}&email_addr=" . $addr[$i]['email'] . "&h=" . $addr[$i]['hash'] . "'>cliquer-ici</a>.<br />";
     $body .= "Ajoutez " . $newsletter['from_addr'] . " &agrave; votre carnet d'adresses pour &ecirc;tre s&ucirc;r de recevoir toutes nos newsletters !<br />";
     $body .= "<hr noshade='' color='#D4D4D4' width='90%' size='1'></div>";
     $new_url = 'href="' . $row_config_globale['base_url'] . $row_config_globale['path'] . 'r.php?m=' . $msg_id . '&h=' . $addr[$i]['hash'] . '&l=' . $list_id . '&r=';
     $message = preg_replace_callback('/href="(http:\\/\\/)([^"]+)"/', function ($matches) {
         global $new_url;
         return $new_url . urlencode(@$matches[1] . $matches[2]) . '"';
     }, $message);
     $unsubLink = "<br /><div align='center' style='padding-top:10px;font-size:10pt;font-family:arial,helvetica,sans-serif;padding-bottom:10px;color:#878e83;'><hr noshade='' color='#D4D4D4' width='90%' size='1'>Je ne souhaite plus recevoir la newsletter : <a href='" . $row_config_globale['base_url'] . $row_config_globale['path'] . "subscription.php?i={$msg_id}&list_id={$list_id}&op=leave&email_addr=" . $addr[$i]['email'] . "&h=" . $addr[$i]['hash'] . "' style='' target='_blank'>d&eacute;sinscription / unsubscribe</a><br /><a href='http://www.phpmynewsletter.com/' style='' target='_blank'>Phpmynewsletter 2.0</a></div></body></html>";
 } else {
     $unsubLink = $row_config_globale['base_url'] . $row_config_globale['path'] . "subscription.php?i=" . $msg_id . "&list_id={$list_id}&op=leave&email_addr=" . urlencode($addr[$i]['email']) . "&h=" . $addr[$i]['hash'];
 }
 $body .= $trac . $message . $unsubLink;
 $mail->Subject = $subject;
 $mail->Body = $body;
 $mail->addCustomHeader('List-Unsubscribe: <' . $row_config_globale['base_url'] . $row_config_globale['path'] . 'subscription.php?i=' . $msg_id . '&list_id=' . $list_id . '&op=leave&email_addr=' . $addr[$i]['email'] . "&h=" . $addr[$i]['hash'] . '>, <mailto:' . $newsletter['from_addr'] . '>');
 @set_time_limit(300);
 $ms_err_info = '';
 if (!$mail->Send()) {
     $cnx->query("UPDATE " . $row_config_globale['table_send'] . " SET error=error+1 WHERE `id_mail`='" . $msg_id . "' AND `id_list`='" . $list_id . "'");
     $ms_err_info = $mail->ErrorInfo;
 } else {
     $cnx->query("UPDATE " . $row_config_globale['table_send'] . " SET cpt=cpt+1 WHERE `id_mail`='" . $msg_id . "' AND `id_list`='" . $list_id . "'");
     $ms_err_info = 'OK';
 }
 $cnx->query("UPDATE " . $row_config_globale['table_send_suivi'] . " SET nb_send=nb_send+1,last_id_send=" . $addr[$i]['id'] . " WHERE `msg_id`='" . $msg_id . "' AND `list_id`='" . $list_id . "'");
 $endtimesend = microtime(true);
 $time_info = substr($endtimesend - $begintimesend, 0, 5);
 $errstr = $begin + $i + 1 . "\t" . date("H:i:s") . "\t " . $time_info . "\t\t " . $ms_err_info . " \t" . $addr[$i]['email'] . "\r\n";
 if (!$dontlog) {
     fwrite($handler, $errstr, strlen($errstr));
开发者ID:Arnaud69,项目名称:phpmynewsletter-2.0,代码行数:31,代码来源:send.php

示例13: addHeader

 /**
  * Add a custom header to the outgoing email.
  *
  * @param string $Name
  * @param string $Value
  * @since 2.1
  */
 public function addHeader($Name, $Value)
 {
     $this->PhpMailer->addCustomHeader("{$Name}:{$Value}");
 }
开发者ID:korelstar,项目名称:vanilla,代码行数:11,代码来源:class.email.php

示例14: processEmail

 /**
  * Process email.
  *
  * @param \PHPMailer $mail   PHPMailer object.
  * @param array      $params Sending parameters.
  *
  * @uses   Core\Config()
  *
  * @return boolean Result TRUE if the email was successfully sent, FALSE otherwise.
  */
 private static function processEmail(\PHPMailer $mail, array $params)
 {
     $mail->CharSet = 'UTF-8';
     $mail->SetFrom(key($params['from']), current($params['from']));
     $mail->Subject = $params['subject'];
     $mail->AltBody = strip_tags($params['content']);
     $mail->MsgHTML($params['content']);
     if (isset($params['to']) && is_array($params['to'])) {
         foreach ($params['to'] as $toAddr => $toName) {
             $mail->AddAddress($toAddr, $toName);
         }
     }
     if (isset($params['reply_to']) && is_array($params['reply_to'])) {
         foreach ($params['reply_to'] as $replyAddr => $replyName) {
             $mail->AddReplyTo($replyAddr, $replyName);
         }
     }
     if (isset($params['inline_attachments']) && is_array($params['inline_attachments'])) {
         foreach ($params['inline_attachments'] as $attachmentPath => $contentId) {
             $mail->AddEmbeddedImage($attachmentPath, $contentId);
         }
     }
     if (isset($params['custom_headers']) && is_array($params['custom_headers'])) {
         foreach ($params['custom_headers'] as $headerName => $headerValue) {
             $mail->addCustomHeader($headerName, $headerValue);
         }
     }
     return $mail->Send();
 }
开发者ID:weareathlon,项目名称:silla.io,代码行数:39,代码来源:mailer.php

示例15: send

 function send()
 {
     $registry = Registry::getInstance();
     $site_root_absolute = $registry->get('site_root_absolute');
     $mail = new PHPMailer();
     #        $mail->SMTPDebug = 3;                               // Enable verbose debug output
     $mail->isSMTP();
     // Set mailer to use SMTP
     $mail->Host = 'smtp-relay.gmail.com;smtp.gmail.com';
     // Specify main and backup SMTP servers
     #        $mail->Host = 'smtp.gmail.com';                       // Specify main and backup SMTP servers
     $mail->SMTPAuth = true;
     // Enable SMTP authentication
     $mail->Username = 'info@mmotoracks.com';
     // SMTP username
     $mail->Password = 'mmotoracks321';
     // SMTP password
     $mail->SMTPSecure = 'tls';
     // Enable TLS encryption, `ssl` also accepted
     $mail->Port = 587;
     // TCP port to connect to
     $mail->isHTML(true);
     // Set email format to HTML
     $mail->setFrom($this->from);
     $mail->addAddress($this->to);
     // Add a recipient
     #        $mail->addAddress('ellen@example.com');               // Name is optional
     if ($this->reply) {
         $mail->addReplyTo($this->reply);
     }
     #        $mail->addCC('cc@example.com');
     $mail->addBCC('mmoto@jne21.com');
     $mail->Subject = $this->subject;
     $mail->Body = $this->html;
     $mail->AltBody = $this->text;
     if (is_array($this->attachments)) {
         foreach ($this->attachments as $attach) {
             $mail->addAttachment($site_root_absolute . self::BASE_PATH . $this->id . EmailTemplateAttahchment::PATH . $attach->filename);
         }
     }
     if (is_array($this->images)) {
         foreach ($this->images as $image) {
             $mail->addAttachment($site_root_absolute . self::BASE_PATH . $this->id . EmailTemplateEmbedded::PATH . $image->filename, $image->cid, 'base64', null, 'inline');
         }
     }
     foreach ($this->makeHeaders($this->headers) as $name => $value) {
         $mail->addCustomHeader($name, $value);
     }
     $result = $mail->send();
     if (!$result) {
         $this->errorInfo = $mail->ErrorInfo;
     }
     return $result;
 }
开发者ID:jne21,项目名称:hatatool,代码行数:54,代码来源:EmailTemplate.php


注:本文中的PHPMailer::addCustomHeader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。