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


PHP Mailer::setHeader方法代码示例

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


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

示例1: 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

示例2: 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

示例3: send_approve_mail

 /**
  * Send approve-mail to editor of the now approved revision
  *
  * @return bool false if there was an error passing the mail to the MTA
  */
 public function send_approve_mail()
 {
     global $ID;
     global $REV;
     /** @var DokuWiki_Auth_Plugin $auth */
     global $auth;
     $data = pageinfo();
     // get mail receiver
     if (!$REV) {
         $rev = $data['lastmod'];
     } else {
         $rev = $REV;
     }
     $changelog = new PageChangelog($ID);
     $revinfo = $changelog->getRevisionInfo($rev);
     $userinfo = $auth->getUserData($revinfo['user']);
     $receiver = $userinfo['mail'];
     // get mail sender
     $ReplyTo = $data['userinfo']['mail'];
     if ($ReplyTo == $receiver) {
         return true;
     }
     // get mail subject
     $subject = $this->getLang('apr_mail_app_subject');
     // get mail text
     $body = $this->create_mail_body('approve');
     $mail = new Mailer();
     $mail->to($receiver);
     $mail->subject($subject);
     $mail->setBody($body);
     $mail->setHeader("Reply-To", $ReplyTo);
     $returnStatus = $mail->send();
     return $returnStatus;
 }
开发者ID:hefanbo,项目名称:dokuwiki-plugin-publish,代码行数:39,代码来源:mail.php

示例4: 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

示例5: 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


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