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


PHP getMailer函数代码示例

本文整理汇总了PHP中getMailer函数的典型用法代码示例。如果您正苦于以下问题:PHP getMailer函数的具体用法?PHP getMailer怎么用?PHP getMailer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: send

 /**
  * Send newsletter via the Mlmmj mailing list
  *
  * @param string $email
  * @return bool
  */
 function send($email)
 {
     //send content to mailing list
     $mailer = getMailer();
     /* @var $mailer XoopsMailer */
     $mailer->useMail();
     $mailer->setBody($this->body);
     $mailer->setFromEmail($this->fromEmail);
     $mailer->setFromName($this->fromName);
     if (count($this->headers) > 0) {
         foreach ($this->headers as $header) {
             $mailer->addHeaders($header);
         }
     }
     $mailer->setSubject($this->subject);
     $mailer->multimailer->isHTML(true);
     //$this->addAttachments($mailer);
     //Send to specified email
     $mailer->setToEmails($email);
     if (!$mailer->send(true)) {
         echo $mailer->getErrors();
         return false;
     }
     return true;
 }
开发者ID:trabisdementia,项目名称:xuups,代码行数:31,代码来源:previewmailer.php

示例2: sendComment

function sendComment()
{
    global $xoopsUser, $xoopsModule, $xoopsModuleConfig, $mc, $xoopsConfig;
    $util =& RMUtils::getInstance();
    if (!$util->validateToken()) {
        redirect_header('comment.php', 2, _MS_TC_ERRID);
        die;
    }
    foreach ($_POST as $k => $v) {
        ${$k} = $v;
    }
    if ($name == '' || $email == '' || $comment == '') {
        redirect_header('comment.php', 2, _MS_TC_ERRFIELDS);
        die;
    }
    $xoopsMailer =& getMailer();
    $xoopsMailer->useMail();
    $xoopsMailer->setTemplate('mail.tpl');
    $xoopsMailer->assign('SITENAME', $xoopsConfig['sitename']);
    $xoopsMailer->assign('ADMINMAIL', $xoopsConfig['adminmail']);
    $xoopsMailer->assign('SITEURL', XOOPS_URL . "/");
    $xoopsMailer->assign('NAME', $name);
    $xoopsMailer->assign('EMAIL', $email);
    $xoopsMailer->assign('COMMENTS', $comment);
    $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . "/modules/team/language/" . $xoopsConfig['language'] . "/");
    $xoopsMailer->setFromEmail($email);
    $xoopsMailer->setFromName($name);
    $xoopsMailer->setSubject(sprintf(_MS_TC_COMFROM, $xoopsConfig['sitename'] . ": " . $xoopsModule->name()));
    $xoopsMailer->setToEmails($xoopsModuleConfig['email']);
    if (!$xoopsMailer->send(true)) {
        redirect_header('comment.php', 2, $xoopsMailer->getErrors());
    } else {
        redirect_header('./', 1, _MS_TC_COMTHX);
    }
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:35,代码来源:comment.php

示例3: send

 /**
  * Send newsletter via the SmartMail Mail Sender Service Interface
  *
  * @param array $recipients
  * @return bool
  */
 function send($recipients)
 {
     $output = $this->getXML($recipients);
     // Debug data - will be removed
     $filename = XOOPS_UPLOAD_PATH . "/mailtest.xml";
     $fp = fopen($filename, "w");
     fwrite($fp, $output);
     //send content to mailing list
     $mailer = getMailer();
     /* @var $mailer XoopsMailer */
     $mailer->useMail();
     $mailer->setBody($output);
     $mailer->setFromEmail($this->fromEmail);
     $mailer->setFromName($this->fromName);
     if (count($this->headers) > 0) {
         foreach ($this->headers as $header) {
             $mailer->addHeaders($header);
         }
     }
     $mailer->setSubject($this->subject);
     $mailer->multimailer->isHTML(true);
     //Send to specified email
     $mailer->setToEmails($this->email);
     if (!$mailer->send(true)) {
         echo $mailer->getErrors();
         return false;
     }
     return true;
 }
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:35,代码来源:smartmailer.php

示例4: testServices

 public function testServices()
 {
     $ins = getAuth();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Auth\IAuth::class, $ins);
     $ins = getView();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\View\IView::class, $ins);
     $ins = getLog();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Log\ILog::class, $ins);
     //        $ins = getDB();
     //        $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Database\MedooDB::class, $ins);
     //        $ins = getRedis();
     //        $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Database\PRedis::class, $ins);
     //        $ins = getDataPool();
     //        $this->assertInstanceOf(\Wwtg99\DataPool\Common\IDataPool::class, $ins);
     $ins = getCache();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Storage\Cache::class, $ins);
     $ins = getSession();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Storage\SessionUtil::class, $ins);
     $ins = getCookie();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Storage\CookieUtil::class, $ins);
     $ins = getOValue();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Storage\OldValue::class, $ins);
     $ins = getAssets();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\View\AssetsManager::class, $ins);
     $ins = getMailer();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Utils\Mail::class, $ins);
     $ins = Flight::Express();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Utils\Express::class, $ins);
     $ins = getPlugin('php');
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Plugin\IPlugin::class, $ins);
 }
开发者ID:wwtg99,项目名称:flight2wwu,代码行数:31,代码来源:ComponentTester.php

示例5: ccenter_com_approve

function ccenter_com_approve(&$comment)
{
    global $xoopsDB, $xoopsUser, $xoopsModule, $xoopsConfig;
    $msgid = $comment->getVar('com_itemid');
    $res = $xoopsDB->query("SELECT uid, touid, email, onepass, fidref, title, status FROM " . CCMES . ", " . FORMS . " WHERE msgid={$msgid} AND formid=fidref");
    $comid = $comment->getVar('com_id');
    if ($res && $xoopsDB->getRowsNum($res)) {
        $data = $xoopsDB->fetchArray($res);
        $email = $data['email'];
        $s = $data['status'];
        $uid = is_object($xoopsUser) ? $xoopsUser->getVar('uid') : 0;
        $msg = _CC_LOG_COMMENT;
        $status = '';
        // new status
        $now = time();
        $values = array('mtime=' . $now);
        if ($uid && $uid == $data['touid']) {
            // comment by charge
            // status to replyed
            if ($s == _STATUS_ACCEPT) {
                $status = _STATUS_REPLY;
            }
            $msg .= _CC_LOG_BYCHARGE;
        } elseif ($uid == 0 || $uid == $data['uid']) {
            // comment by order person
            // status back to contacting
            if ($s == _STATUS_REPLY || $s == _STATUS_CLOSE) {
                $status = _STATUS_ACCEPT;
            }
            $values[] = 'atime=' . $now;
        }
        if ($status && $status != $s) {
            global $msg_status;
            $msg .= "\n" . sprintf(_CC_LOG_STATUS, $msg_status[$s], $msg_status[$status]);
            $values[] = 'status=' . $xoopsDB->quoteString($status);
        }
        $xoopsDB->query("UPDATE " . CCMES . " SET " . join(',', $values) . " WHERE msgid={$msgid}");
        cc_log_message($data['fidref'], $msg . " (comid={$comid})", $msgid);
        // notification for guest contact
        if (is_object($xoopsUser) && $data['uid'] == 0 && $email) {
            $subj = $data['title'];
            $url = XOOPS_URL . "/modules/" . basename(dirname(__FILE__)) . "/message.php?id={$msgid}&p=" . urlencode($data['onepass']) . "#comment{$comid}";
            $tags = array('X_MODULE' => $xoopsModule->getVar('name'), 'X_ITEM_TYPE' => '', 'X_ITEM_NAME' => $subj, 'X_COMMENT_URL' => $url, 'FROM_EMAIL' => $email, 'SUBJECT' => $subj);
            $xoopsMailer =& getMailer();
            $xoopsMailer->useMail();
            $xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
            $xoopsMailer->setFromName($xoopsModule->getVar('name'));
            $xoopsMailer->setSubject(_MD_NOTIFY_SUBJ);
            $xoopsMailer->assign($tags);
            $tpl = 'guest_notify.tpl';
            $xoopsMailer->setTemplateDir(template_dir($tpl));
            $xoopsMailer->setTemplate($tpl);
            $xoopsMailer->setToEmails($email);
            $xoopsMailer->send();
        }
    }
}
开发者ID:nbuy,项目名称:xoops-modules-ccenter,代码行数:57,代码来源:comment_functions.php

示例6: addEmail

function addEmail($email)
{
    if ($email != "") {
        // Add Mailerspecific link
        $result = "<a href=" . '"' . getMailer() . $email . '"' . ">" . $email . "</a>";
        // Add a link to the guess homepage
        $homepage = guessOneHomepage($email);
        if (!isset($_GET["print"]) && $homepage != "") {
            $result .= " (<a href=" . '"http://' . $homepage . '" target="_new"' . ">" . $homepage . "</a>)";
        }
        return add($result);
    } else {
        return "";
    }
}
开发者ID:karanikn,项目名称:php-addressbook,代码行数:15,代码来源:view.w.php

示例7: send_mail

function send_mail($s, $valid)
{
    global $tpl;
    $tpl->assign('user', $s);
    if (isset($_POST["send"])) {
        $mail = getMailer();
        $mail->AddAddress($s->user_email);
        $mail->Subject = '[intra LATEB] ' . $_POST['title'];
        $mail->Body = $tpl->fetch('mail_send.tpl');
        if ($mail->Send() == false) {
            $valid[] = $s->user_email;
        }
    }
    return $valid;
}
开发者ID:bontiv,项目名称:intrateb,代码行数:15,代码来源:ml.php

示例8: main

function main()
{
    global $session;
    global $db_connect_info;
    global $http_user_email;
    if ($session->started()) {
        navigateTo(HREF_MAIN);
    }
    $http_user_email = trim($_POST['user-email']);
    // 입력 값의 유효성을 검증한다.
    if (empty($http_user_email)) {
        return array('result' => true, 'message' => '');
    }
    // 이메일 포멧의 유효성을 검증한다.
    if (!filter_var($http_user_email, FILTER_VALIDATE_EMAIL)) {
        return array('result' => false, 'message' => '이메일 주소가 올바르지 않습니다');
    }
    // reCAPTCHA를 검증한다.
    if (!getReCaptcha()) {
        return array('result' => false, 'message' => 'reCAPTCHA가 올바르게 입력되지 않았습니다');
    }
    $db = new YwDatabase($db_connect_info);
    // 데이터베이스 연결을 체크한다.
    if (!$db->connect()) {
        return array('result' => false, 'message' => '서버와의 연결에 실패했습니다');
    }
    // 아이디와 이메일 유효성을 검증한다.
    if (!$db->query("SELECT `name` FROM " . USER_TABLE . " WHERE `email`='" . $db->purify($http_user_email) . "';")) {
        return array('result' => false, 'message' => '이메일 주소를 조회하는데 실패했습니다');
    }
    if ($db->total_results() < 1) {
        return array('result' => false, 'message' => '존재하지 않는 이메일 주소입니다');
    }
    $result = $db->get_result();
    $user_name = $result['name'];
    // 새로운 비밀번호를 생성한다.
    $generated_password = bin2hex(openssl_random_pseudo_bytes(6));
    if (!$db->query("UPDATE " . USER_TABLE . " SET `password`='" . passwordHash($generated_password) . "' WHERE `email`='" . $db->purify($http_user_email) . "';")) {
        return array('result' => false, 'message' => '비밀번호를 업데이트하는데 실패했습니다');
    }
    $email_content = "<b>" . $user_name . "</b> 회원님의 새 비밀번호는 <b>" . $generated_password . "</b>입니다.";
    if (!getMailer($http_user_email, "연세위키 비밀번호를 알려드립니다", $email_content)) {
        return array('result' => false, 'message' => '이메일 발송에 실패했습니다');
    }
    $db->log($user_name, LOG_RESET, '1');
    $db->close();
    return array('result' => true, 'message' => '이메일로 아이디와 새로운 비밀번호를 전송했습니다');
}
开发者ID:agemor,项目名称:yaong-wiki,代码行数:48,代码来源:page.reset.php

示例9: send_message

function send_message()
{
    global $xoopsModule, $xoopsModuleConfig, $xoopsUser;
    $name = rmc_server_var($_POST, 'name', '');
    $email = rmc_server_var($_POST, 'email', '');
    $company = rmc_server_var($_POST, 'company', '');
    $phone = rmc_server_var($_POST, 'phone', '');
    $subject = rmc_server_var($_POST, 'subject', '');
    $message = rmc_server_var($_POST, 'message', '');
    if ($name == '' || $email == '' || !checkEmail($email) || $subject == '' || $message == '') {
        redirect_header($xoopsModuleConfig['url'], 1, __('Please fill all required fileds before to send this message!', 'contact'));
        die;
    }
    // Recaptcha check
    if (!RMEvents::get()->run_event('rmcommon.captcha.check', true)) {
        redirect_header($xoopsModuleConfig['url'], 1, __('Please check the security words and write it correctly!', 'contact'));
        die;
    }
    $xoopsMailer =& getMailer();
    $xoopsMailer->useMail();
    $xoopsMailer->setBody($message . "\n--------------\n" . __('Message sent with ContactMe!', 'contact') . "\n" . $xoopsModuleConfig['url']);
    $xoopsMailer->setToEmails($xoopsModuleConfig['mail']);
    $xoopsMailer->setFromEmail($email);
    $xoopsMailer->setFromName($name);
    $xoopsMailer->setSubject($subject);
    if (!$xoopsMailer->send(true)) {
        redirect_header($xoopsModuleConfig['url'], 1, __('Message could not be delivered. Please try again.', 'contact'));
        die;
    }
    // Save message on database for further use
    $msg = new CTMessage();
    $msg->setVar('subject', $subject);
    $msg->setVar('ip', $_SERVER['REMOTE_ADDR']);
    $msg->setVar('email', $email);
    $msg->setVar('name', $name);
    $msg->setVar('org', $company);
    $msg->setVar('body', $message);
    $msg->setVar('phone', $phone);
    $msg->setVar('register', $xoopsUser ? 1 : 0);
    if ($xoopsUser) {
        $msg->setVar('xuid', $xoopsUser->uid());
    }
    $msg->setVar('date', time());
    $msg->save();
    redirect_header(XOOPS_URL, 1, __('Your message has been sent successfully!', 'contact'));
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:46,代码来源:index.php

示例10: execute

 function execute(&$controller, &$xoopsUser)
 {
     $this->mActionForm->fetch();
     $this->mActionForm->validate();
     if ($this->mActionForm->hasError()) {
         return LEGACY_FRAME_VIEW_INPUT;
     }
     $root =& XCube_Root::getSingleton();
     $this->mMailer =& getMailer();
     $this->mMailer->setTemplate("tellfriend.tpl");
     $this->mMailer->assign("SITENAME", $root->mContext->getXoopsConfig('sitename'));
     $this->mMailer->assign("ADMINMAIL", $root->mContext->getXoopsConfig('adminmail'));
     $this->mMailer->assign("SITEURL", XOOPS_URL . '/');
     $this->mActionForm->update($this->mMailer);
     $root->mLanguageManager->loadPageTypeMessageCatalog("misc");
     $this->mMailer->setSubject(sprintf(_MSC_INTSITE, $root->mContext->getXoopsConfig('sitename')));
     return $this->mMailer->send() ? LEGACY_FRAME_VIEW_SUCCESS : LEGACY_FRAME_VIEW_ERROR;
 }
开发者ID:nouphet,项目名称:rata,代码行数:18,代码来源:MiscFriendAction.class.php

示例11: tellafriend_sendMail

function tellafriend_sendMail($tMail, $bSenMail = true, $numError = 0)
{
    global $xoopsDB, $xoopsModuleConfig;
    $formatDate = 'Y-m-d H:i:s';
    $tMail['new_date'] = date($formatDate);
    //---------------------------------------------------
    if ($bSenMail) {
        $xoopsMailer =& getMailer();
        $xoopsMailer->useMail();
        $xoopsMailer->setToEmails($tMail['users_to']);
        $xoopsMailer->setFromEmail($tMail['users_email']);
        $xoopsMailer->setFromName($tMail['users_name']);
        $xoopsMailer->setSubject($tMail['users_subject']);
        $xoopsMailer->setBody($tMail['message_body']);
        $send_result = $xoopsMailer->send();
        if ($send_result) {
            $tMail['result'] = _MI_TAF_MESSAGESENT;
        } else {
            $tMail['result'] = _MI_TAF_SENDERROR;
        }
    } else {
        switch ($numError) {
            case 1:
                $tMail['result'] = _MI_TAF_INVALIDMAILFROM;
                break;
            case 2:
                $tMail['result'] = _MI_TAF_INVALIDMAILTO;
                break;
            case 3:
                $tMail['result'] = _MI_TAF_TOOMANY;
                break;
            default:
                break;
        }
    }
    //---------------------------------------------------
    if ($send_result || $xoopsModuleConfig['log_send_in_echec']) {
        $xoopsDB->query("INSERT INTO " . $xoopsDB->prefix("tellafriend_log") . " SET " . "uid='{$tMail['uid']}'," . "ip='{$tMail['REMOTE_ADDR']}'," . "mail_fromname='" . addslashes($tMail['users_name']) . "'," . "mail_fromemail='" . addslashes($tMail['users_email']) . "'," . "mail_to='" . addslashes($tMail['users_to']) . "'," . "mail_subject='" . addslashes($tMail['users_subject']) . "'," . "mail_body='" . addslashes($tMail['message_body']) . "'," . "agent='" . addslashes($tMail['HTTP_USER_AGENT']) . "'," . "result='" . addslashes($tMail['result']) . "'," . "date_send='{$tMail['new_date']}'");
    }
    //---------------------------------------------------
    return $tMail['result'];
}
开发者ID:jjdai,项目名称:tellafriend,代码行数:42,代码来源:functions.php

示例12: user_notify

function user_notify($eid)
{
    global $xoopsDB, $xoopsConfig;
    $result = $xoopsDB->query("SELECT title,edate,expire,status,topicid FROM " . EGTBL . " WHERE eid={$eid}");
    if (!$result || $xoopsDB->getRowsNum($result) == 0) {
        echo "<div class='error'>Not found Event(eid='{$eid}')</div>\n";
        return;
    }
    $data = $xoopsDB->fetchArray($result);
    $title = $data['title'];
    $edate = $data['edate'];
    $expire = $data['expire'];
    // using XOOPS2 notification system
    if (!$GLOBALS['xoopsModuleConfig']['user_notify'] || ($expire > $edate ? $expire < time() : $edate + $expire < time()) || $data['status'] != STAT_NORMAL) {
        return false;
    }
    $tags = array('EVENT_TITLE' => $title, 'EVENT_DATE' => eventdate($edate, _MD_TIME_FMT), 'EVENT_NOTE' => '', 'EVENT_URL' => EGUIDE_URL . "/event.php?eid={$eid}");
    $notification_handler =& xoops_gethandler('notification');
    $notification_handler->triggerEvent('global', 0, 'new', $tags);
    $notification_handler->triggerEvent('category', $data['topicid'], 'new', $tags);
    $result = $xoopsDB->query("SELECT rvid, email, confirm FROM " . RVTBL . " WHERE eid=0");
    while ($data = $xoopsDB->fetchArray($result)) {
        $xoopsMailer =& getMailer();
        $xoopsMailer->useMail();
        $xoopsMailer->setSubject(_MD_NEWSUB);
        $tpl = 'notify_user_new.tpl';
        $xoopsMailer->setTemplateDir(template_dir($tpl));
        $xoopsMailer->setTemplate($tpl);
        $xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
        $xoopsMailer->setFromName(eguide_from_name());
        $xoopsMailer->assign($tags);
        $xoopsMailer->assign("CANCEL_URL", EGUIDE_URL . "/reserv.php?op=cancel&rvid=" . $data['rvid'] . "&key=" . $data['confirm']);
        $xoopsMailer->setToEmails($data['email']);
        if (!$xoopsMailer->send()) {
            echo "<div class='error'>" . $xoopsMailer->getErrors() . "</div>\n";
        }
    }
}
开发者ID:nbuy,项目名称:xoops-modules-eguide,代码行数:38,代码来源:notify.inc.php

示例13: notifyUser

 /**
  * Send a notification message to the user
  *
  * @param  string  $template_dir  Template directory
  * @param  string  $template      Template name
  * @param  string  $subject       Subject line for notification message
  * @param  array   $tags Array of substitutions for template variables
  *
  * @return  bool	true if success, false if error
  **/
 function notifyUser($template_dir, $template, $subject, $tags)
 {
     // Check the user's notification preference.
     $member_handler = xoops_gethandler('member');
     $user =& $member_handler->getUser($this->getVar('not_uid'));
     if (!is_object($user)) {
         return true;
     }
     $method = $user->getVar('notify_method');
     $xoopsMailer =& getMailer();
     include_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
     switch ($method) {
         case XOOPS_NOTIFICATION_METHOD_PM:
             $xoopsMailer->usePM();
             $config_handler = xoops_gethandler('config');
             $xoopsMailerConfig =& $config_handler->getConfigsByCat(XOOPS_CONF_MAILER);
             $xoopsMailer->setFromUser($member_handler->getUser($xoopsMailerConfig['fromuid']));
             foreach ($tags as $k => $v) {
                 $xoopsMailer->assign($k, $v);
             }
             break;
         case XOOPS_NOTIFICATION_METHOD_EMAIL:
             $xoopsMailer->useMail();
             foreach ($tags as $k => $v) {
                 $xoopsMailer->assign($k, preg_replace("/&amp;/i", '&', $v));
             }
             break;
         default:
             return true;
             // report error in user's profile??
             break;
     }
     // Set up the mailer
     $xoopsMailer->setTemplateDir($template_dir);
     $xoopsMailer->setTemplate($template);
     $xoopsMailer->setToUsers($user);
     //global $xoopsConfig;
     //$xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
     //$xoopsMailer->setFromName($xoopsConfig['sitename']);
     $xoopsMailer->setSubject($subject);
     $success = $xoopsMailer->send();
     // If send-once-then-delete, delete notification
     // If send-once-then-wait, disable notification
     include_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
     $notification_handler = xoops_gethandler('notification');
     if ($this->getVar('not_mode') == XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE) {
         $notification_handler->delete($this);
         return $success;
     }
     if ($this->getVar('not_mode') == XOOPS_NOTIFICATION_MODE_SENDONCETHENWAIT) {
         $this->setVar('not_mode', XOOPS_NOTIFICATION_MODE_WAITFORLOGIN);
         $notification_handler->insert($this);
     }
     return $success;
 }
开发者ID:nunoluciano,项目名称:uxcl,代码行数:65,代码来源:notification.php

示例14: sendMail

 function sendMail()
 {
     $mail_body = $this->makeMailBody();
     $cc_mail_body = $this->makeCCMailBody();
     $subject = $this->makeMailSubject();
     $cc_subject = $this->makeCCMailSubject();
     // easiestml
     if (function_exists('easiestml')) {
         $mail_body = easiestml($mail_body);
         $cc_mail_body = easiestml($cc_mail_body);
         $subject = easiestml($subject);
         $cc_subject = easiestml($cc_subject);
     }
     // send main mail (server to admin/poster)
     if (!empty($this->toEmails)) {
         // initialize
         $toMailer =& getMailer();
         $toMailer->useMail();
         $toMailer->setFromEmail($this->fromEmail);
         $toMailer->setFromName($this->fromName);
         // "from" overridden by form data
         if (!empty($this->from_field_name) && $this->isValidEmail($this->form_processor->fields[$this->from_field_name]['value'])) {
             $toMailer->setFromEmail($this->form_processor->fields[$this->from_field_name]['value']);
             if (!empty($this->fromname_field_name) && !empty($this->form_processor->fields[$this->fromname_field_name]['value'])) {
                 // remove cr, lf, null
                 $toMailer->setFromName(str_replace(array("\n", "\r", ""), '', $this->form_processor->fields[$this->fromname_field_name]['value']));
             }
         }
         // "Reply-To" header
         if (!empty($this->replyto_field_name) && $this->isValidEmail($this->form_processor->fields[$this->replyto_field_name]['value'])) {
             $toMailer->addHeaders('Reply-To: ' . $this->form_processor->fields[$this->replyto_field_name]['value']);
         }
         $toMailer->setToEmails(array_unique($this->toEmails));
         $toMailer->setSubject($subject);
         $toMailer->setBody($mail_body);
         $toMailer->send();
     }
     // send confirming mail (server to visitor)
     if (!empty($this->cc_field_name) && !empty($this->form_processor->fields[$this->cc_field_name]['value'])) {
         // initialize
         $ccMailer =& getMailer();
         $ccMailer->useMail();
         $ccMailer->setFromEmail($this->fromEmail);
         $ccMailer->setFromName($this->fromName);
         $ccMailer->setToEmails($this->form_processor->fields[$this->cc_field_name]['value']);
         $ccMailer->setSubject($cc_subject);
         $ccMailer->setBody($cc_mail_body);
         $ccMailer->send();
     }
 }
开发者ID:BackupTheBerlios,项目名称:peakxoops-svn,代码行数:50,代码来源:PicoFormProcessBySmartyBase.class.php

示例15: order_notify

function order_notify($data, $email, $value)
{
    global $xoopsModuleConfig, $xoopsUser, $xoopsModule;
    $poster = new XoopsUser($data['uid']);
    $eid = $data['eid'];
    $exid = $data['exid'];
    $url = EGUIDE_URL . '/event.php?eid=' . $eid . ($exid ? "&sub={$exid}" : '');
    $xoopsMailer =& getMailer();
    $xoopsMailer->useMail();
    $tplname = $data['autoaccept'] ? "accept%s.tpl" : "order%s.tpl";
    $extra = eguide_form_options('reply_extension');
    $tplfile = sprintf($tplname, '');
    // default template name
    $tmpdir = template_dir($tplfile);
    if ($extra) {
        $vals = unserialize_text($value);
        if (isset($vals[$extra])) {
            $extpl = sprintf($tplname, $vals[$extra]);
            if (file_exists("{$tmpdir}{$extpl}")) {
                $tplfile = $extpl;
            }
        }
    } else {
        $extra = eguide_form_options('reply_tpl_suffix');
        if ($extra) {
            $extpl = sprintf($tplname, $extra);
            if (file_exists("{$tmpdir}{$extpl}")) {
                $tplfile = $extpl;
            }
        }
    }
    $xoopsMailer->setTemplateDir($tmpdir);
    $xoopsMailer->setTemplate($tplfile);
    if ($xoopsModuleConfig['member_only'] && is_object($xoopsUser)) {
        $user = $xoopsUser;
        if (isset($data['reserv_uid'])) {
            $ruid = $data['reserv_uid'];
            $user = new XoopsUser($ruid);
        } else {
            $xoopsMailer->setToUsers($user);
        }
        $uinfo = sprintf("%s: %s (%s)\n", _MD_UNAME, $user->getVar('uname'), $user->getVar('name'));
    } else {
        if (!empty($email)) {
            $xoopsMailer->setToEmails($email);
        }
        $uinfo = "";
    }
    if ($email) {
        $uinfo .= sprintf("%s: %s\n", _MD_EMAIL, $email);
    }
    $rvid = $data['rvid'];
    $conf = $data['confirm'];
    $edate = eventdate($data['edate']);
    $tags = array("EVENT_URL" => $url, "RVID" => $rvid, "CANCEL_KEY" => $conf, "CANCEL_URL" => EGUIDE_URL . "/reserv.php?op=cancel&rvid={$rvid}&key={$conf}", "INFO" => $uinfo . $value, "TITLE" => $edate . " " . $data['title'], "EVENT_DATE" => $edate, "EVENT_TITLE" => $data['title'], "SUMMARY" => strip_tags($data['summary']));
    $subj = eguide_form_options('reply_subject', _MD_SUBJECT);
    $xoopsMailer->assign($tags);
    $xoopsMailer->setSubject($subj);
    $xoopsMailer->setFromEmail($poster->getVar('email'));
    $xoopsMailer->setFromName(eguide_from_name());
    $ret = $xoopsMailer->send();
    // send to order person
    if (!$ret) {
        return $ret;
    }
    $xoopsMailer->reset();
    $xoopsMailer->useMail();
    $xoopsMailer->setTemplateDir(template_dir($tplfile));
    $xoopsMailer->setTemplate($tplfile);
    $xoopsMailer->assign($tags);
    $xoopsMailer->setSubject($subj);
    $xoopsMailer->setFromEmail($poster->getVar('email'));
    $xoopsMailer->setFromName(eguide_from_name());
    if ($data['notify']) {
        if (!in_array($xoopsModuleConfig['notify_group'], $poster->groups())) {
            $xoopsMailer->setToUsers($poster);
        }
        $member_handler =& xoops_gethandler('member');
        $notify_group = $member_handler->getGroup($xoopsModuleConfig['notify_group']);
        $xoopsMailer->setToGroups($notify_group);
        $xoopsMailer->send();
    }
    return $ret;
}
开发者ID:nbuy,项目名称:xoops-modules-eguide,代码行数:84,代码来源:functions.php


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