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


PHP Mailer::to方法代码示例

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


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

示例1: handle

 /**
  * handle user request
  */
 function handle()
 {
     global $INPUT;
     global $conf;
     if (!$INPUT->bool('send')) {
         return;
     }
     // make sure debugging is on;
     $conf['plugin']['smtp']['debug'] = 1;
     // send a mail
     $mail = new Mailer();
     if ($INPUT->str('to')) {
         $mail->to($INPUT->str('to'));
     }
     if ($INPUT->str('cc')) {
         $mail->to($INPUT->str('cc'));
     }
     if ($INPUT->str('bcc')) {
         $mail->to($INPUT->str('bcc'));
     }
     $mail->subject('DokuWiki says hello');
     $mail->setBody("Hi @USER@\n\nThis is a test from @DOKUWIKIURL@");
     $ok = $mail->send();
     // check result
     if ($ok) {
         msg('Message was sent. SMTP seems to work.', 1);
     } else {
         msg('Message wasn\'t sent. SMTP seems not to work properly.', -1);
     }
 }
开发者ID:marktsai0316,项目名称:dokuwiki-plugin-smtp,代码行数:33,代码来源:admin.php

示例2: act_resendpwd

/**
 * Send a  new password
 *
 * This function handles both phases of the password reset:
 *
 *   - handling the first request of password reset
 *   - validating the password reset auth token
 *
 * @author Benoit Chesneau <benoit@bchesneau.info>
 * @author Chris Smith <chris@jalakai.co.uk>
 * @author Andreas Gohr <andi@splitbrain.org>
 *
 * @return bool true on success, false on any error
 */
function act_resendpwd()
{
    global $lang;
    global $conf;
    /* @var auth_basic $auth */
    global $auth;
    /* @var Input $INPUT */
    global $INPUT;
    if (!actionOK('resendpwd')) {
        msg($lang['resendna'], -1);
        return false;
    }
    $token = preg_replace('/[^a-f0-9]+/', '', $INPUT->str('pwauth'));
    if ($token) {
        // we're in token phase - get user info from token
        $tfile = $conf['cachedir'] . '/' . $token[0] . '/' . $token . '.pwauth';
        if (!@file_exists($tfile)) {
            msg($lang['resendpwdbadauth'], -1);
            $INPUT->remove('pwauth');
            return false;
        }
        // token is only valid for 3 days
        if (time() - filemtime($tfile) > 3 * 60 * 60 * 24) {
            msg($lang['resendpwdbadauth'], -1);
            $INPUT->remove('pwauth');
            @unlink($tfile);
            return false;
        }
        $user = io_readfile($tfile);
        $userinfo = $auth->getUserData($user);
        if (!$userinfo['mail']) {
            msg($lang['resendpwdnouser'], -1);
            return false;
        }
        if (!$conf['autopasswd']) {
            // we let the user choose a password
            $pass = $INPUT->str('pass');
            // password given correctly?
            if (!$pass) {
                return false;
            }
            if ($pass != $INPUT->str('passchk')) {
                msg($lang['regbadpass'], -1);
                return false;
            }
            // change it
            if (!$auth->triggerUserMod('modify', array($user, array('pass' => $pass)))) {
                msg('error modifying user data', -1);
                return false;
            }
        } else {
            // autogenerate the password and send by mail
            $pass = auth_pwgen();
            if (!$auth->triggerUserMod('modify', array($user, array('pass' => $pass)))) {
                msg('error modifying user data', -1);
                return false;
            }
            if (auth_sendPassword($user, $pass)) {
                msg($lang['resendpwdsuccess'], 1);
            } else {
                msg($lang['regmailfail'], -1);
            }
        }
        @unlink($tfile);
        return true;
    } else {
        // we're in request phase
        if (!$INPUT->post->bool('save')) {
            return false;
        }
        if (!$INPUT->post->str('login')) {
            msg($lang['resendpwdmissing'], -1);
            return false;
        } else {
            $user = trim($auth->cleanUser($INPUT->post->str('login')));
        }
        $userinfo = $auth->getUserData($user);
        if (!$userinfo['mail']) {
            msg($lang['resendpwdnouser'], -1);
            return false;
        }
        // generate auth token
        $token = md5(auth_cookiesalt() . $user);
        //secret but user based
        $tfile = $conf['cachedir'] . '/' . $token[0] . '/' . $token . '.pwauth';
        $url = wl('', array('do' => 'resendpwd', 'pwauth' => $token), true, '&');
//.........这里部分代码省略.........
开发者ID:AlexanderS,项目名称:Part-DB,代码行数:101,代码来源:auth.php

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

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

示例5: mail

        $headers .= 'From: marcz@lab1521.com' . "\r\n";
        return mail($this->email, $this->subject, $this->message, $headers);
    }
}
$emailTemplate = '<table>
        <tr><th>First Name</th><td>{{nameFirst}}</td></tr>
        <tr><th>Last Name</th><td>{{nameLast}}</td></tr>
        <tr><th>Email</th><td>{{email}}</td></tr>
        <tr><th>Phone</th><td>{{phone}}</td></tr>
        <tr><th>Message</th><td></td></tr>
        <tr><td colspan="2">{{message}}</td></tr>
    </table>
    ';
$antiSpam = new AntiSpam();
$mailer = new Mailer();
$mailer->to('info@patriarch.co.nz');
$mailer->subject('Online Enquiry To VineyardForSale');
$mailer->setTemplate($emailTemplate);
if (isset($_POST['antiSpamAnswer']) && isset($_POST['antiSpamToken'])) {
    $form = new ContactForm();
    $form->setFields(array('nameFirst' => 'required|sanitize', 'nameLast' => 'required|sanitize', 'email' => 'required|email', 'phone' => 'required|sanitize', 'message' => 'required|sanitize', 'antiSpamAnswer' => 'required|sanitize', 'antiSpamToken' => 'required|sanitize'));
    $form->setSource($_POST);
    $form->setFilter(array($antiSpam, 'answer'), array('antiSpamAnswer', 'antiSpamToken'));
    $validation = $form->validate();
    if ($validation['success']) {
        $mailer->fillTemplate($form->getFields());
        $mailer->send();
    }
    JSON::output($validation);
}
JSON::output($antiSpam->question());
开发者ID:marczhermo,项目名称:Gulp-Bower-Starter,代码行数:31,代码来源:contact.php

示例6: transmitMessage

 /**
  * Transmit the message via email to the address on file.
  * As a special case, configure the mail settings to send only via text.
  */
 public function transmitMessage($message, $force = false)
 {
     if (!$this->canUse() && !$force) {
         return false;
     }
     global $USERINFO, $conf;
     // Disable HTML for text messages.
     $oldconf = $conf['htmlmail'];
     $conf['htmlmail'] = 0;
     $number = $this->attribute->get("twofactor", "phone");
     if (!$number) {
         msg("TwoFactor: User has not defined a phone number.  Failing.", -1);
         // If there is no phone number, then fail.
         return false;
     }
     $gateway = $this->attribute->get("twofactorsmsgateway", "provider");
     msg("{$number}@{$gateway}");
     $providers = $this->_getProviders();
     if (array_key_exists($gateway, $providers)) {
         $to = "{$number}@{$providers[$gateway]}";
     } else {
         $to = '';
     }
     if (!$to) {
         msg("TwoFactor: Unable to define To field for email.  Failing.", -1);
         // If there is no recipient address, then fail.
         return false;
     }
     // Create the email object.
     $mail = new Mailer();
     $subject = $conf['title'] . ' login verification';
     $mail->to($to);
     $mail->subject($subject);
     $mail->setText($message);
     $result = $mail->send();
     // Reset the email config in case another email gets sent.
     $conf['htmlmail'] = $oldconf;
     // This is here only for debugging for me for now.  My windows box can't send out emails :P
     #if (!result) { msg($message, 0); return true;}
     return $result;
 }
开发者ID:wilminator,项目名称:dokuwiki-plugin-twofactorsmsgateway,代码行数:45,代码来源:helper.php

示例7: media_notify

/**
 * Send a notify mail on uploads
 *
 * @author Andreas Gohr <andi@splitbrain.org>
 * @fixme this should embed thumbnails of images in HTML version
 */
function media_notify($id, $file, $mime, $old_rev = false)
{
    global $lang;
    global $conf;
    global $INFO;
    if (empty($conf['notify'])) {
        return;
    }
    //notify enabled?
    $text = rawLocale('uploadmail');
    $trep = array('MIME' => $mime, 'MEDIA' => ml($id, '', true, '&', true), 'SIZE' => filesize_h(filesize($file)));
    if ($old_rev && $conf['mediarevisions']) {
        $trep['OLD'] = ml($id, "rev={$old_rev}", true, '&', true);
    } else {
        $trep['OLD'] = '---';
    }
    $mail = new Mailer();
    $mail->to($conf['notify']);
    $mail->subject($lang['mail_upload'] . ' ' . $id);
    $mail->setBody($text, $trep);
    return $mail->send();
}
开发者ID:nextghost,项目名称:dokuwiki,代码行数:28,代码来源:media.php

示例8: transmitMessage

 /**
  * Transmit the message via email to the address on file.
  * As a special case, configure the mail settings to send only via text.
  */
 public function transmitMessage($message, $force = false)
 {
     if (!$this->canUse() && !$force) {
         return false;
     }
     $to = $this->attribute->get("twofactoremail", "email");
     // Create the email object.
     $mail = new Mailer();
     $subject = $conf['title'] . ' login verification';
     $mail->to($to);
     $mail->subject($subject);
     $mail->setText($message);
     $result = $mail->send();
     // This is here only for debugging for me for now.  My windows box can't send out emails :P
     #if (!result) { msg($message, 0); return true;}
     return $result;
 }
开发者ID:wilminator,项目名称:dokuwiki-plugin-twofactoremail,代码行数:21,代码来源:helper.php

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

示例10: transmitMessage

 /**
  * Transmit the message via email to the address on file.
  * As a special case, configure the mail settings to send only via text.
  */
 public function transmitMessage($message, $force = false)
 {
     if (!$this->canUse() && !$force) {
         return false;
     }
     $to = $this->_settingGet("email");
     // Create the email object.
     $mail = new Mailer();
     $subject = $conf['title'] . ' login verification';
     $mail->to($to);
     $mail->subject($subject);
     $mail->setText($message);
     $result = $mail->send();
     return $result;
 }
开发者ID:wilminator,项目名称:dokuwiki-plugin-twofactoraltemail,代码行数:19,代码来源:helper.php


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