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


PHP Mailer::mail方法代码示例

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


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

示例1: control

 public function control()
 {
     if (isset($_POST['Submit']) && $_POST['Submit'] == 'Send Reset') {
         $this->disableCaching();
         $dao = DAOFactory::getDAO('OwnerDAO');
         $user = $dao->getByEmail($_POST['email']);
         if (isset($user)) {
             $token = $user->setPasswordRecoveryToken();
             $es = new SmartyThinkUp();
             $es->caching = false;
             $config = Config::getInstance();
             $es->assign('apptitle', $config->getValue('app_title'));
             $es->assign('recovery_url', "session/reset.php?token={$token}");
             $es->assign('server', isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost');
             $es->assign('site_root_path', $config->getValue('site_root_path'));
             $message = $es->fetch('_email.forgotpassword.tpl');
             Mailer::mail($_POST['email'], $config->getValue('app_title') . " Password Recovery", $message);
             $this->addSuccessMessage('Password recovery information has been sent to your email address.');
         } else {
             $this->addErrorMessage('Error: account does not exist.');
         }
     }
     $this->setViewTemplate('session.forgot.tpl');
     return $this->generateView();
 }
开发者ID:NickBall,项目名称:ThinkUp,代码行数:25,代码来源:class.ForgotPasswordController.php

示例2: control

 public function control()
 {
     $config = Config::getInstance();
     $this->addToView('is_registration_open', $config->getValue('is_registration_open'));
     if (isset($_POST['Submit']) && $_POST['Submit'] == 'Send Reset') {
         $this->disableCaching();
         $dao = DAOFactory::getDAO('OwnerDAO');
         $user = $dao->getByEmail($_POST['email']);
         if (isset($user)) {
             $token = $user->setPasswordRecoveryToken();
             $es = new ViewManager();
             $es->caching = false;
             $es->assign('apptitle', $config->getValue('app_title_prefix') . "ThinkUp");
             $es->assign('recovery_url', "session/reset.php?token={$token}");
             $es->assign('application_url', Utils::getApplicationURL($false));
             $es->assign('site_root_path', $config->getValue('site_root_path'));
             $message = $es->fetch('_email.forgotpassword.tpl');
             Mailer::mail($_POST['email'], $config->getValue('app_title_prefix') . "ThinkUp Password Recovery", $message);
             $this->addSuccessMessage('Password recovery information has been sent to your email address.');
         } else {
             $this->addErrorMessage('Error: account does not exist.');
         }
     }
     $this->view_mgr->addHelp('forgot', 'userguide/accounts/index');
     $this->setViewTemplate('session.forgot.tpl');
     return $this->generateView();
 }
开发者ID:kuthulas,项目名称:ProjectX,代码行数:27,代码来源:class.ForgotPasswordController.php

示例3: sendSummary

function sendSummary()
{
    $userMail = Mailer::mailFromUser('mail');
    if (!$userMail) {
        return false;
    }
    $userMail = stripslashes($userMail);
    $mailText = 'Hallo,' . "\n" . 'hier eine Zusammenfassung aller Bücher, die mit deiner E-Mailadresse angeboten werden.';
    $books = new UsersBooks($userMail);
    $mailText .= $books->toString();
    return Mailer::mail($userMail, 'Deine Angebote', $mailText);
}
开发者ID:BackupTheBerlios,项目名称:ubook-svn,代码行数:12,代码来源:summary.php

示例4: testMandrill

 public function testMandrill()
 {
     $config = Config::getInstance();
     $config->setValue("app_title_prefix", "My Crazy Custom ");
     $config->setValue("mandrill_api_key", "1234567890");
     $_SERVER['HTTP_HOST'] = "thinkup.com";
     Mailer::mail('you@example.com', 'Testing 123', 'Me worky, yo?');
     $email_body = Mailer::getLastMail();
     $this->debug($email_body);
     // Exact JSON structure copied from Mandrill's site
     $json = '{"text":"Me worky, yo?","subject":"Testing 123","from_email":"notifications@thinkup.com",' . '"from_name":"My Crazy Custom ThinkUp","to":[{"email":"you@example.com","name":"you@example.com"}]}';
     // Compare JSON string, ignoring whitespace differences
     $this->assertEqual($json, $email_body);
 }
开发者ID:jkuehl-carecloud,项目名称:ThinkUp,代码行数:14,代码来源:TestOfMailer.php

示例5: testFromName

 public function testFromName()
 {
     $config = Config::getInstance();
     $config->setValue("app_title_prefix", "My Crazy Custom ");
     $_SERVER['HTTP_HOST'] = "my_thinkup_hostname";
     Mailer::mail('you@example.com', 'Testing 123', 'Me worky, yo?');
     $email_body = Mailer::getLastMail();
     $this->debug($email_body);
     $this->assertPattern('/From: "My Crazy Custom ThinkUp" <notifications@my_thinkup_hostname>/', $email_body);
     $config->setValue("app_title_prefix", "My Other Installation of ");
     $_SERVER['HTTP_HOST'] = "my_other_hostname";
     Mailer::mail('you@example.com', 'Testing 123', 'Me worky, yo?');
     $email_body = Mailer::getLastMail();
     $this->debug($email_body);
     $this->assertPattern('/From: "My Other Installation of ThinkUp" <notifications@my_other_hostname>/', $email_body);
 }
开发者ID:JWFoxJr,项目名称:ThinkUp,代码行数:16,代码来源:TestOfMailer.php

示例6: stripslashes

require_once 'mysql_conn.php';
if (isset($_POST['subject'])) {
    require_once 'books/UsersBooks.php';
    require_once 'tools/Mailer.php';
    $subject = stripslashes($_POST['subject']);
    $text = stripslashes($_POST['text']);
    $query = 'select distinct mail from books';
    $result = mysql_query($query);
    $user_number = mysql_num_rows($result);
    $sent_mails = 0;
    while ($mail_row = mysql_fetch_row($result)) {
        $mail = $mail_row[0];
        $bookList = new UsersBooks($mail);
        $books = $bookList->toString();
        $mail_text = $text . $books;
        $success = Mailer::mail($mail, $subject, $mail_text);
        if ($success) {
            $sent_mails++;
        }
    }
    header('Location: admin_mail.php?sent_mails=' . $sent_mails . '&user_number=' . $user_number);
}
include 'header.php';
?>

<div class="menu"><span><a href="admin.php">&larr; Zurück zur
Administrationsübersicht</a></span></div>

  <?php 
if (isset($_GET['sent_mails'])) {
    ?>
开发者ID:BackupTheBerlios,项目名称:ubook-svn,代码行数:31,代码来源:admin_mail.php

示例7: generateUpgradeToken

 /**
  * Generates a one time upgrade token, and emails admins with the token info.
  */
 public static function generateUpgradeToken()
 {
     $token_file = FileDataManager::getDataPath('.htupgrade_token');
     $md5_token = '';
     if (!file_exists($token_file)) {
         $fp = fopen($token_file, 'w');
         if ($fp) {
             $token = self::TOKEN_KEY . rand(0, time());
             $md5_token = md5($token);
             if (!fwrite($fp, $md5_token)) {
                 throw new OpenFileException("Unable to write upgrade token file: " + $token_file);
             }
             fclose($fp);
         } else {
             throw new OpenFileException("Unable to create upgrade token file: " + $token_file);
         }
         // email our admin with this token.
         $owner_dao = DAOFactory::getDAO('OwnerDAO');
         $admins = $owner_dao->getAdmins();
         if ($admins) {
             $tos = array();
             foreach ($admins as $admin) {
                 $tos[] = $admin->email;
             }
             $to = join(',', $tos);
             $upgrade_email = new ViewManager();
             $upgrade_email->caching = false;
             $upgrade_email->assign('application_url', Utils::getApplicationURL(false));
             $upgrade_email->assign('token', $md5_token);
             $message = $upgrade_email->fetch('_email.upgradetoken.tpl');
             $config = Config::getInstance();
             Mailer::mail($to, "Upgrade Your ThinkUp Database", $message);
         }
     }
 }
开发者ID:randomecho,项目名称:ThinkUp,代码行数:38,代码来源:class.UpgradeDatabaseController.php

示例8: generateUpgradeToken

 /**
  * Generates a one time upgrade token, and emails admins with the token info.
  */
 public function generateUpgradeToken()
 {
     $token_file = THINKUP_WEBAPP_PATH . self::CACHE_DIR . '/upgrade_token';
     $md5_token = '';
     if (!file_exists($token_file)) {
         $fp = fopen($token_file, 'w');
         if ($fp) {
             $token = self::TOKEN_KEY . rand(0, time());
             $md5_token = md5($token);
             if (!fwrite($fp, $md5_token)) {
                 throw new OpenFileException("Unable to write upgrade token file: " + $token_file);
             }
             fclose($fp);
         } else {
             throw new OpenFileException("Unable to create upgrade token file: " + $token_file);
         }
         // email our admin with this token.
         $owner_dao = DAOFactory::getDAO('OwnerDAO');
         $admins = $owner_dao->getAdmins();
         if ($admins) {
             $tos = array();
             foreach ($admins as $admin) {
                 $tos[] = $admin->email;
             }
             $to = join(',', $tos);
             $upgrade_email = new SmartyThinkUp();
             $upgrade_email->caching = false;
             $server = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost';
             //supress test weirdness
             $upgrade_email->assign('server', $server);
             $upgrade_email->assign('token', $md5_token);
             $message = $upgrade_email->fetch('_email.upgradetoken.tpl');
             $config = Config::getInstance();
             Mailer::mail($to, "Upgrade Your ThinkUp Database", $message);
         }
     }
 }
开发者ID:hendrasaputra,项目名称:ThinkUp,代码行数:40,代码来源:class.UpgradeController.php

示例9: SmartyThinkTank

            if ($od->doesOwnerExist($_POST['email'])) {
                $errormsg = "User account already exists.";
            } else {
                $es = new SmartyThinkTank();
                $es->caching = false;
                $activ_code = rand(1000, 9999);
                $cryptpass = $session->pwdcrypt($_POST['pass2']);
                $server = $_SERVER['HTTP_HOST'];
                $od->create($_POST['email'], $cryptpass, $_POST['country'], $activ_code, $_POST['full_name']);
                $es->assign('apptitle', $THINKTANK_CFG['app_title']);
                $es->assign('server', $server);
                $es->assign('site_root_path', $THINKTANK_CFG['site_root_path']);
                $es->assign('email', urlencode($_POST[email]));
                $es->assign('activ_code', $activ_code);
                $message = $es->fetch('_email.registration.tpl');
                Mailer::mail($_POST['email'], "Activate Your " . $THINKTANK_CFG['app_title'] . " Account", $message);
                echo $message;
                unset($_SESSION['ckey']);
                $successmsg = "Success! Check your email for an activation link.";
            }
        }
        $s->assign('name', $_POST["full_name"]);
        $s->assign('mail', $_POST["email"]);
    }
    $challenge = $captcha->generate($msg);
    $s->assign('captcha', $challenge);
}
if (isset($errormsg)) {
    $s->assign('errormsg', $errormsg);
} elseif (isset($successmsg)) {
    $s->assign('successmsg', $successmsg);
开发者ID:BenBtg,项目名称:thinktank,代码行数:31,代码来源:register.php

示例10: control

 public function control()
 {
     if ($this->isLoggedIn()) {
         $controller = new DashboardController(true);
         return $controller->go();
     } else {
         $this->disableCaching();
         $config = Config::getInstance();
         if (!$config->getValue('is_registration_open')) {
             $this->addToView('closed', true);
             $this->addErrorMessage('<p>Sorry, registration is closed on this ThinkUp installation.</p>' . '<p><a href="http://github.com/ginatrapani/thinkup/tree/master">Install ThinkUp on your own ' . 'server.</a></p>');
         } else {
             $owner_dao = DAOFactory::getDAO('OwnerDAO');
             $this->addToView('closed', false);
             $captcha = new Captcha();
             if (isset($_POST['Submit']) && $_POST['Submit'] == 'Register') {
                 foreach ($this->REQUIRED_PARAMS as $param) {
                     if (!isset($_POST[$param]) || $_POST[$param] == '') {
                         $this->addErrorMessage('Please fill out all required fields.');
                         $this->is_missing_param = true;
                     }
                 }
                 if (!$this->is_missing_param) {
                     if (!Utils::validateEmail($_POST['email'])) {
                         $this->addErrorMessage("Incorrect email. Please enter valid email address.");
                     } elseif (strcmp($_POST['pass1'], $_POST['pass2']) || empty($_POST['pass1'])) {
                         $this->addErrorMessage("Passwords do not match.");
                     } elseif (!$captcha->check()) {
                         // Captcha not valid, captcha handles message...
                     } else {
                         if ($owner_dao->doesOwnerExist($_POST['email'])) {
                             $this->addErrorMessage("User account already exists.");
                         } else {
                             $es = new SmartyThinkUp();
                             $es->caching = false;
                             $session = new Session();
                             $activ_code = rand(1000, 9999);
                             $cryptpass = $session->pwdcrypt($_POST['pass2']);
                             $server = $_SERVER['HTTP_HOST'];
                             $owner_dao->create($_POST['email'], $cryptpass, $activ_code, $_POST['full_name']);
                             $es->assign('server', $server);
                             $es->assign('email', urlencode($_POST['email']));
                             $es->assign('activ_code', $activ_code);
                             $message = $es->fetch('_email.registration.tpl');
                             Mailer::mail($_POST['email'], "Activate Your " . $config->getValue('app_title') . " Account", $message);
                             unset($_SESSION['ckey']);
                             $this->addSuccessMessage("Success! Check your email for an activation link.");
                         }
                     }
                 }
                 if (isset($_POST["full_name"])) {
                     $this->addToView('name', $_POST["full_name"]);
                 }
                 if (isset($_POST["email"])) {
                     $this->addToView('mail', $_POST["email"]);
                 }
             }
             $challenge = $captcha->generate();
             $this->addToView('captcha', $challenge);
         }
         return $this->generateView();
     }
 }
开发者ID:NickBall,项目名称:ThinkUp,代码行数:63,代码来源:class.RegisterController.php

示例11: requestNewPassword

 public function requestNewPassword()
 {
     $id = $_POST['user'];
     if (self::levelOf($id) < 1) {
         return;
     }
     self::cleanChallenges();
     $query = 'insert into challenge (Kunde, challenge) values' . ' ("' . $id . '", md5(rand()));';
     mysql_query($query);
     $query = 'select Kunde, challenge from challenge where' . ' Kunde="' . $id . '";';
     $result = mysql_query($query);
     if (mysql_num_rows($result) != 1) {
         return;
     }
     list($id, $challenge) = mysql_fetch_row($result);
     $subject = 'Neues Passwort';
     $content = "Hallo!\n\n" . 'Für Ihre E-Mailadresse wurde bei der Erlassdatenbank ein' . " neues Passwort beantragt.\n" . "Mit dem folgenden Link kann es neu gesetzt werden:\n" . WEBDIR . '?user=' . urlencode($id) . "&challenge={$challenge}\n\n" . 'Diese Nachricht wurde automatisch versandt.';
     Mailer::mail($id, $subject, $content);
 }
开发者ID:BackupTheBerlios,项目名称:erlassdb,代码行数:19,代码来源:User.php

示例12: mailFromTemplate

 public function mailFromTemplate($code, $to, $replacements = array(), $options = array())
 {
     $this->findTemplateAndMakeReplacements($code, $replacements);
     return Mailer::mail($to, $this->_template->subject, $this->_template->plaintext_body, $this->_template->html_body, $options);
 }
开发者ID:loristissino,项目名称:swu,代码行数:5,代码来源:MailTemplate.php

示例13: _afterInsert

 /**
  * 插入后置操作,向留言表增加刚插入id
  *
  * @author          mrmsl <msl-138@163.com>
  * @date            2013-03-01 13:30:52
  *
  * @param $data     插入数据
  * @param $options  查询表达式
  *
  * @return void 无返回值
  */
 protected function _afterInsert($data, $options)
 {
     if (TB_COMMENTS != $options['table']) {
         return;
     }
     $pk_value = $data[$this->_pk_field];
     if ($parent_info = C('T_PARENT_INFO')) {
         //父
         $max_reply_level = $this->_module->getGuestbookCommentsSetting(C('T_VERIFYCODE_MODULE'), 'max_reply_level');
         if ($max_reply_level == $parent_info['level']) {
             //最多5层回复
             $log = get_method_line(__METHOD__, __LINE__, LOG_INVALID_PARAM) . ',level>' . $max_reply_level . var_export($parent_info, true);
             trigger_error($log);
             $parent_info['level']--;
             $parent_info['node'] = substr($parent_info['node'], 0, strrpos($parent_info['node'], ','));
             $node_arr = explode(',', $parent_info['node']);
             $parent_id = $node_arr[$max_reply_level > 2 ? $max_reply_level - 2 : 1];
             //父级id取第四个
         }
         $update = array('level' => $parent_info['level'] + 1, 'node' => $parent_info['node'] . ',' . $pk_value);
         if (!empty($parent_id)) {
             $update['parent_id'] = $parent_id;
         }
         $this->where($this->_pk_field . '=' . $pk_value)->save($update);
         $this->where(array($this->_pk_field => array('IN', $parent_info['node'])))->save(array('last_reply_time' => time()));
         //更新最上层最后回复时间
     } else {
         $update = array('node' => $pk_value);
         $this->where($this->_pk_field . '=' . $pk_value)->save($update);
         //节点关系
     }
     if ($v = $this->_module->getGuestbookCommentsSetting(C('T_VERIFYCODE_MODULE'), 'alternation')) {
         //间隔
         session(C('T_VERIFYCODE_MODULE'), time() + $v);
     }
     $type = C('T_TYPE');
     if (!$this->_module->getGuestbookCommentsSetting(C('T_VERIFYCODE_MODULE'), 'check')) {
         //不需要审核
         if (COMMENT_TYPE_GUESTBOOK != $type) {
             //评论数+1
             $this->execute('UPDATE ' . (COMMENT_TYPE_BLOG == $type ? TB_BLOG : TB_MINIBLOG) . ' SET comments=comments+1 WHERE blog_id=' . $data['blog_id']);
         }
         if (($parent_info = C('T_PARENT_INFO')) && $parent_info['at_email']) {
             require_cache(LIB_PATH . 'Mailer.class.php');
             $mailer = new Mailer($this);
             $mailer->mail('comments_at_email', $parent_info);
         }
     }
     //总评论数+1
     COMMENT_TYPE_GUESTBOOK != $type && $this->execute('UPDATE ' . (COMMENT_TYPE_BLOG == $type ? TB_BLOG : TB_MINIBLOG) . ' SET total_comments=total_comments+1 WHERE blog_id=' . $data['blog_id']);
     $this->commit();
 }
开发者ID:yunsite,项目名称:yablog,代码行数:63,代码来源:CommentsModel.class.php

示例14: clean

 private function clean()
 {
     $subject = 'Suche beendet';
     $fixMailContent = 'Hallo!' . "\n" . "\n" . 'Folgende Suche(n) wurde(n) beendet und können über den Link neu' . "\n" . 'eingetragen werden:' . "\n";
     $toClean = array();
     $query = 'select search, mail from searches where life_counter=0;';
     $r = mysql_query($query);
     while ($search_array = mysql_fetch_array($r)) {
         $mail = $search_array['mail'];
         if (!isset($toClean[$mail])) {
             $toClean[$mail] = array();
         }
         $toClean[$mail][] = $search_array['search'];
     }
     $query = 'delete from searches where life_counter <= 0;';
     mysql_query($query);
     $query = 'update searches set life_counter = life_counter - 1;';
     mysql_query($query);
     foreach ($toClean as $mail => $searchArray) {
         $mailContent = $fixMailContent;
         foreach ($searchArray as $i => $search) {
             $mailContent .= "\n" . $search . "\n" . WEBDIR . 'save_search.php?search=' . urlencode($search) . '&mail=' . urlencode($mail) . "\n";
         }
         Mailer::mail($mail, $subject, $mailContent);
     }
 }
开发者ID:BackupTheBerlios,项目名称:ubook-svn,代码行数:26,代码来源:Searches.php

示例15: _afterSetField

 /**
  * {@inheritDoc}
  */
 protected function _afterSetField($field, $value, $pk_id)
 {
     if ('status' == $field) {
         //审核状态
         $this->_afterAction();
         if ($at_email = C('T_INFO.at_email')) {
             require_cache(LIB_PATH . 'Mailer.class.php');
             $mailer = new Mailer($this->_model);
             foreach ($at_email as $v) {
                 $mailer->mail('comments_at_email', $v);
             }
         }
     }
 }
开发者ID:yunsite,项目名称:yablog,代码行数:17,代码来源:CommentsController.class.php


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