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


PHP Mailer::bcc方法代码示例

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


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

示例1: notify

/**
 * Sends a notify mail on page change or registration
 *
 * @param string     $id       The changed page
 * @param string     $who      Who to notify (admin|subscribers|register)
 * @param int|string $rev Old page revision
 * @param string     $summary  What changed
 * @param boolean    $minor    Is this a minor edit?
 * @param array      $replace  Additional string substitutions, @KEY@ to be replaced by value
 *
 * @return bool
 * @author Andreas Gohr <andi@splitbrain.org>
 */
function notify($id, $who, $rev = '', $summary = '', $minor = false, $replace = array())
{
    global $lang;
    global $conf;
    global $INFO;
    global $DIFF_INLINESTYLES;
    // decide if there is something to do, eg. whom to mail
    if ($who == 'admin') {
        if (empty($conf['notify'])) {
            return false;
        }
        //notify enabled?
        $text = rawLocale('mailtext');
        $to = $conf['notify'];
        $bcc = '';
    } elseif ($who == 'subscribers') {
        if (!$conf['subscribers']) {
            return false;
        }
        //subscribers enabled?
        if ($conf['useacl'] && $_SERVER['REMOTE_USER'] && $minor) {
            return false;
        }
        //skip minors
        $data = array('id' => $id, 'addresslist' => '', 'self' => false);
        trigger_event('COMMON_NOTIFY_ADDRESSLIST', $data, 'subscription_addresslist');
        $bcc = $data['addresslist'];
        if (empty($bcc)) {
            return false;
        }
        $to = '';
        $text = rawLocale('subscr_single');
    } elseif ($who == 'register') {
        if (empty($conf['registernotify'])) {
            return false;
        }
        $text = rawLocale('registermail');
        $to = $conf['registernotify'];
        $bcc = '';
    } else {
        return false;
        //just to be safe
    }
    // prepare replacements (keys not set in hrep will be taken from trep)
    $trep = array('NEWPAGE' => wl($id, '', true, '&'), 'PAGE' => $id, 'SUMMARY' => $summary);
    $trep = array_merge($trep, $replace);
    $hrep = array();
    // prepare content
    if ($who == 'register') {
        $subject = $lang['mail_new_user'] . ' ' . $summary;
    } elseif ($rev) {
        $subject = $lang['mail_changed'] . ' ' . $id;
        $trep['OLDPAGE'] = wl($id, "rev={$rev}", true, '&');
        $df = new Diff(explode("\n", rawWiki($id, $rev)), explode("\n", rawWiki($id)));
        $dformat = new UnifiedDiffFormatter();
        $tdiff = $dformat->format($df);
        $DIFF_INLINESTYLES = true;
        $dformat = new InlineDiffFormatter();
        $hdiff = $dformat->format($df);
        $hdiff = '<table>' . $hdiff . '</table>';
        $DIFF_INLINESTYLES = false;
    } else {
        $subject = $lang['mail_newpage'] . ' ' . $id;
        $trep['OLDPAGE'] = '---';
        $tdiff = rawWiki($id);
        $hdiff = nl2br(hsc($tdiff));
    }
    $trep['DIFF'] = $tdiff;
    $hrep['DIFF'] = $hdiff;
    // send mail
    $mail = new Mailer();
    $mail->to($to);
    $mail->bcc($bcc);
    $mail->subject($subject);
    $mail->setBody($text, $trep, $hrep);
    if ($who == 'subscribers') {
        $mail->setHeader('List-Unsubscribe', '<' . wl($id, array('do' => 'subscribe'), true, '&') . '>', false);
    }
    return $mail->send();
}
开发者ID:nextghost,项目名称:dokuwiki,代码行数:93,代码来源:common.php

示例2: send

 /**
  * Helper function for sending a mail
  *
  * @author Adrian Lang <lang@cosmocode.de>
  *
  * @param string $subscriber_mail The target mail address
  * @param string $subject         The lang id of the mail subject (without the
  *                                prefix “mail_”)
  * @param string $context         The context of this mail, eg. page or namespace id
  * @param string $template        The name of the mail template
  * @param array  $trep            Predefined parameters used to parse the
  *                                template (in text format)
  * @param array  $hrep            Predefined parameters used to parse the
  *                                template (in HTML format), null to default to $trep
  * @param array  $headers         Additional mail headers in the form 'name' => 'value'
  * @return bool
  */
 protected function send($subscriber_mail, $subject, $context, $template, $trep, $hrep = null, $headers = array())
 {
     global $lang;
     global $conf;
     $text = rawLocale($template);
     $subject = $lang['mail_' . $subject] . ' ' . $context;
     $mail = new Mailer();
     $mail->bcc($subscriber_mail);
     $mail->subject($subject);
     $mail->setBody($text, $trep, $hrep);
     if (in_array($template, array('subscr_list', 'subscr_digest'))) {
         $mail->from($conf['mailfromnobody']);
     }
     if (isset($trep['SUBSCRIBE'])) {
         $mail->setHeader('List-Unsubscribe', '<' . $trep['SUBSCRIBE'] . '>', false);
     }
     foreach ($headers as $header => $value) {
         $mail->setHeader($header, $value);
     }
     return $mail->send();
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:38,代码来源:subscription.php

示例3: subscription_send

/**
 * Helper function for sending a mail
 *
 * @param string $subscriber_mail The target mail address
 * @param array  $replaces        Predefined parameters used to parse the
 *                                template
 * @param string $subject         The lang id of the mail subject (without the
 *                                prefix “mail_”)
 * @param string $id              The page or namespace id
 * @param string $template        The name of the mail template
 *
 * @author Adrian Lang <lang@cosmocode.de>
 */
function subscription_send($subscriber_mail, $replaces, $subject, $id, $template)
{
    global $conf;
    global $lang;
    $text = rawLocale($template);
    $trep = array_merge($replaces, array('PAGE' => $id));
    $subject = $lang['mail_' . $subject] . ' ' . $id;
    $mail = new Mailer();
    $mail->bcc($subscriber_mail);
    $mail->subject($subject);
    $mail->setBody($text, $trep);
    $mail->setHeader('List-Unsubscribe', '<' . wl($id, array('do' => 'subscribe'), true, '&') . '>', false);
    return $mail->send();
}
开发者ID:nextghost,项目名称:dokuwiki,代码行数:27,代码来源:subscription.php

示例4: Mailer

 /**
  * Sends a notify mail on new comment
  *
  * @param  array  $comment  data array of the new comment
  * @param  array  $subscribers data of the subscribers
  *
  * @author Andreas Gohr <andi@splitbrain.org>
  * @author Esther Brunner <wikidesign@gmail.com>
  */
 function _notify($comment, &$subscribers)
 {
     global $conf;
     global $ID;
     $notify_text = io_readfile($this->localfn('subscribermail'));
     $confirm_text = io_readfile($this->localfn('confirmsubscribe'));
     $subject_notify = '[' . $conf['title'] . '] ' . $this->getLang('mail_newcomment');
     $subject_subscribe = '[' . $conf['title'] . '] ' . $this->getLang('subscribe');
     $mailer = new Mailer();
     if (empty($_SERVER['REMOTE_USER'])) {
         $mailer->from($conf['mailfromnobody']);
     }
     $replace = array('PAGE' => $ID, 'TITLE' => $conf['title'], 'DATE' => dformat($comment['date']['created'], $conf['dformat']), 'NAME' => $comment['user']['name'], 'TEXT' => $comment['raw'], 'COMMENTURL' => wl($ID, '', true) . '#comment_' . $comment['cid'], 'UNSUBSCRIBE' => wl($ID, 'do=subscribe', true, '&'), 'DOKUWIKIURL' => DOKU_URL);
     $confirm_replace = array('PAGE' => $ID, 'TITLE' => $conf['title'], 'DOKUWIKIURL' => DOKU_URL);
     $mailer->subject($subject_notify);
     $mailer->setBody($notify_text, $replace);
     // send mail to notify address
     if ($conf['notify']) {
         $mailer->bcc($conf['notify']);
         $mailer->send();
     }
     // notify page subscribers
     if (actionOK('subscribe')) {
         $data = array('id' => $ID, 'addresslist' => '', 'self' => false);
         if (class_exists('Subscription')) {
             /* Introduced in DokuWiki 2013-05-10 */
             trigger_event('COMMON_NOTIFY_ADDRESSLIST', $data, array(new Subscription(), 'notifyaddresses'));
         } else {
             /* Old, deprecated default handler */
             trigger_event('COMMON_NOTIFY_ADDRESSLIST', $data, 'subscription_addresslist');
         }
         $to = $data['addresslist'];
         if (!empty($to)) {
             $mailer->bcc($to);
             $mailer->send();
         }
     }
     // notify comment subscribers
     if (!empty($subscribers)) {
         foreach ($subscribers as $mail => $data) {
             $mailer->bcc($mail);
             if ($data['active']) {
                 $replace['UNSUBSCRIBE'] = wl($ID, 'do=discussion_unsubscribe&hash=' . $data['hash'], true, '&');
                 $mailer->subject($subject_notify);
                 $mailer->setBody($notify_text, $replace);
                 $mailer->send();
             } elseif (!$data['active'] && !$data['confirmsent']) {
                 $confirm_replace['SUBSCRIBE'] = wl($ID, 'do=discussion_confirmsubscribe&hash=' . $data['hash'], true, '&');
                 $mailer->subject($subject_subscribe);
                 $mailer->setBody($confirm_text, $confirm_replace);
                 $mailer->send();
                 $subscribers[$mail]['confirmsent'] = true;
             }
         }
     }
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:65,代码来源:action.php

示例5: _notify

 /**
  * Sends a notify mail on new comment
  *
  * @param  array  $comment  data array of the new comment
  * @param  array  $subscribers data of the subscribers
  *
  * @author Andreas Gohr <andi@splitbrain.org>
  * @author Esther Brunner <wikidesign@gmail.com>
  */
 protected function _notify($comment, &$subscribers)
 {
     global $conf;
     global $ID;
     $notify_text = io_readfile($this->localfn('subscribermail'));
     $confirm_text = io_readfile($this->localfn('confirmsubscribe'));
     $subject_notify = '[' . $conf['title'] . '] ' . $this->getLang('mail_newcomment');
     $subject_subscribe = '[' . $conf['title'] . '] ' . $this->getLang('subscribe');
     $mailer = new Mailer();
     if (empty($_SERVER['REMOTE_USER'])) {
         $mailer->from($conf['mailfromnobody']);
     }
     $replace = array('PAGE' => $ID, 'TITLE' => $conf['title'], 'DATE' => dformat($comment['date']['created'], $conf['dformat']), 'NAME' => $comment['user']['name'], 'TEXT' => $comment['raw'], 'COMMENTURL' => wl($ID, '', true) . '#comment_' . $comment['cid'], 'UNSUBSCRIBE' => wl($ID, 'do=subscribe', true, '&'), 'DOKUWIKIURL' => DOKU_URL);
     $confirm_replace = array('PAGE' => $ID, 'TITLE' => $conf['title'], 'DOKUWIKIURL' => DOKU_URL);
     $mailer->subject($subject_notify);
     $mailer->setBody($notify_text, $replace);
     // send mail to notify address
     if ($conf['notify']) {
         $mailer->bcc($conf['notify']);
         $mailer->send();
     }
     // send email to moderators
     if ($this->getConf('moderatorsnotify')) {
         $mods = trim($this->getConf('moderatorgroups'));
         if (!empty($mods)) {
             global $auth;
             // create a clean mods list
             $mods = explode(',', $mods);
             $mods = array_map('trim', $mods);
             $mods = array_unique($mods);
             $mods = array_filter($mods);
             // search for moderators users
             foreach ($mods as $mod) {
                 if (!$auth->isCaseSensitive()) {
                     $mod = utf8_strtolower($mod);
                 }
                 // create a clean mailing list
                 $dests = array();
                 if ($mod[0] == '@') {
                     foreach ($auth->retrieveUsers(0, 0, array('grps' => $auth->cleanGroup(substr($mod, 1)))) as $user) {
                         if (!empty($user['mail'])) {
                             array_push($dests, $user['mail']);
                         }
                     }
                 } else {
                     $userdata = $auth->getUserData($auth->cleanUser($mod));
                     if (!empty($userdata['mail'])) {
                         array_push($dests, $userdata['mail']);
                     }
                 }
                 $dests = array_unique($dests);
                 // notify the users
                 $mailer->bcc(implode(',', $dests));
                 $mailer->send();
             }
         }
     }
     // notify page subscribers
     if (actionOK('subscribe')) {
         $data = array('id' => $ID, 'addresslist' => '', 'self' => false);
         if (class_exists('Subscription')) {
             /* Introduced in DokuWiki 2013-05-10 */
             trigger_event('COMMON_NOTIFY_ADDRESSLIST', $data, array(new Subscription(), 'notifyaddresses'));
         } else {
             /* Old, deprecated default handler */
             trigger_event('COMMON_NOTIFY_ADDRESSLIST', $data, 'subscription_addresslist');
         }
         $to = $data['addresslist'];
         if (!empty($to)) {
             $mailer->bcc($to);
             $mailer->send();
         }
     }
     // notify comment subscribers
     if (!empty($subscribers)) {
         foreach ($subscribers as $mail => $data) {
             $mailer->bcc($mail);
             if ($data['active']) {
                 $replace['UNSUBSCRIBE'] = wl($ID, 'do=discussion_unsubscribe&hash=' . $data['hash'], true, '&');
                 $mailer->subject($subject_notify);
                 $mailer->setBody($notify_text, $replace);
                 $mailer->send();
             } elseif (!$data['active'] && !$data['confirmsent']) {
                 $confirm_replace['SUBSCRIBE'] = wl($ID, 'do=discussion_confirmsubscribe&hash=' . $data['hash'], true, '&');
                 $mailer->subject($subject_subscribe);
                 $mailer->setBody($confirm_text, $confirm_replace);
                 $mailer->send();
                 $subscribers[$mail]['confirmsent'] = true;
             }
         }
     }
//.........这里部分代码省略.........
开发者ID:cziehr,项目名称:plugin-discussion,代码行数:101,代码来源:action.php

示例6: subscription_send

/**
 * Helper function for sending a mail
 *
 * @author Adrian Lang <lang@cosmocode.de>
 *
 * @param string $subscriber_mail The target mail address
 * @param array  $replaces        Predefined parameters used to parse the
 *                                template
 * @param string $subject         The lang id of the mail subject (without the
 *                                prefix “mail_”)
 * @param string $id              The page or namespace id
 * @param string $template        The name of the mail template
 * @return bool
 */
function subscription_send($subscriber_mail, $replaces, $subject, $id, $template)
{
    global $lang;
    global $conf;
    $text = rawLocale($template);
    $trep = array_merge($replaces, array('PAGE' => $id));
    $hrep = $trep;
    $hrep['DIFF'] = nl2br(htmlspecialchars($hrep['DIFF']));
    $subject = $lang['mail_' . $subject] . ' ' . $id;
    $mail = new Mailer();
    $mail->bcc($subscriber_mail);
    $mail->subject($subject);
    $mail->setBody($text, $trep, $hrep);
    $mail->from($conf['mailfromnobody']);
    $mail->setHeader('List-Unsubscribe', '<' . wl($id, array('do' => 'subscribe'), true, '&') . '>', false);
    return $mail->send();
}
开发者ID:AlexanderS,项目名称:Part-DB,代码行数:31,代码来源:subscription.php

示例7: send_mail

 private function send_mail($to, $subject, $content, $from, $cc, $bcc)
 {
     // send a mail
     $mail = new Mailer();
     $mail->to($to);
     $mail->cc($cc);
     $mail->bcc($bcc);
     $mail->from($from);
     $mail->subject($subject);
     $mail->setBody($content);
     $ok = $mail->send();
     return $ok;
 }
开发者ID:bzfwunde,项目名称:dokuwiki-groupmail,代码行数:13,代码来源:syntax.php


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