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


PHP smtpmail函数代码示例

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


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

示例1: SendEmailByPlaces

function SendEmailByPlaces($plid, $title, $txt)
{
    global $sqlcn;
    $sql = "SELECT userid AS uid, users.email AS email FROM places_users\n          INNER JOIN users ON users.id = places_users.userid WHERE places_users.placesid ={$plid} AND users.email <>  ''";
    $result = $sqlcn->ExecuteSQL($sql);
    while ($row = mysqli_fetch_array($result)) {
        smtpmail($row['email'], $title, $txt);
    }
}
开发者ID:Kozlov-V,项目名称:webuseorg3,代码行数:9,代码来源:equipment_form.php

示例2: Send_mail_BP_userlist

function Send_mail_BP_userlist($randomid, $title, $txt)
{
    global $cfg;
    $result = mysql_query("SELECT * FROM bp_userlist INNER JOIN users ON bp_userlist.userid=users.id WHERE bp_userlist.randomid='{$randomid}'", $cfg->base_id);
    if ($result != '') {
        while ($myrow = mysql_fetch_array($result)) {
            //echo "!!!$myrow[email], $title, $txt!!!";
            smtpmail($myrow[email], $title, $txt);
        }
    }
}
开发者ID:Kozlov-V,项目名称:webuseorg3,代码行数:11,代码来源:bp_xml_form_addedit.php

示例3: create_inet_mail

 function create_inet_mail($to_user_name, $to_user_email, $subject_text, $msgbody_text, $from = '')
 {
     global $cfg, $board_config;
     // The sending mail address must be the sys_part_mail, otherwise some mail-provider won't send the mail.
     // Set default Sender-Mail, if non is set
     if (!$from) {
         $from = $cfg['sys_party_mail'];
     }
     // No special charachters in Username!
     $to_user_name = preg_replace('#[^a-zA-Z ]#', '', $to_user_name);
     // Do not send, when in intranet mode
     if (!$cfg['sys_internet']) {
         $this->error = t('Um Internet-Mails zu versenden, muss sich Lansuite im Internet-Modus befinden');
         return false;
     }
     // Set Charset
     if ($cfg['mail_utf8']) {
         $CharsetStr = ' charset=utf-8';
     } else {
         $CharsetStr = '';
         $subject_text = utf8_decode($subject_text);
         $msgbody_text = utf8_decode($msgbody_text);
     }
     $this->inet_headers = "MIME-Version: 1.0\n";
     $this->inet_headers .= "Content-type: text/plain;{$CharsetStr}\n";
     $this->inet_headers .= "From: {$from}\n";
     // Cut out double line breaks
     $msgbody_text = str_replace("\r", '', $msgbody_text);
     // SMTP-Mail
     if ($cfg["mail_use_smtp"]) {
         $board_config["smtp_host"] = $cfg["mail_smtp_host"];
         $board_config["smtp_username"] = $cfg["mail_smtp_user"];
         $board_config["smtp_password"] = $cfg["mail_smtp_pass"];
         $board_config["board_email"] = $from;
         include_once "modules/mail/smtp.php";
         if (smtpmail($to_user_email, $subject_text, $msgbody_text, $this->inet_headers)) {
             return true;
         } else {
             return false;
         }
         // PHP-Mail
     } else {
         if (@mail("{$to_user_name} <{$to_user_email}>", $subject_text, $msgbody_text, $this->inet_headers)) {
             return true;
         } else {
             return false;
         }
     }
 }
开发者ID:eistr2n,项目名称:lansuite,代码行数:49,代码来源:class_mail.php

示例4: trim

<?php

include_once 'smtp-func.php';
//include smtp-func.php
$recepient = "manager@gp-studio.ru";
//ваш email
$sitename = "shof.gp-studio.ru";
//имя сайта
$name = trim($_POST["name"]);
//имя
$phone = trim($_POST["phone"]);
//телефон
$email = trim($_POST["email"]);
//email
$message = "Имя: {$name} \nТелефон: {$phone} \nEmail: {$email}";
//\nEmail: $email // сообщение
$pagetitle = "Новая заявка с сайта \"{$sitename}\"";
//тема письма
smtpmail($recepient, $pagetitle, $message, "Content-type: text/plain; charset=\"utf-8\"\n From: {$recepient}");
//отправка письма
// автоответчик
$autoanswer = "Заявка с сайта \"{$sitename}\"";
$automessage = "Здравствуйте, вы оставили заявку. С вами свяжутся в ближайшее время.\n\nC ув. менеджер \"{$sitename}\"";
smtpmail($email, $autoanswer, $automessage, "Content-type: text/plain; charset=\"utf-8\"\n From: {$recepient}");
开发者ID:MrVladevoit,项目名称:shofacademy,代码行数:24,代码来源:mail.php

示例5: sendEMail

function sendEMail($from, $to, $subject, $body)
{
    $message = '<html><head><meta charset="utf-8"><title>' . $subject . '</title></head><body><p>' . $body . '</p></body></html>';
    /* Для отправки HTML-почты вы можете установить шапку Content-type. */
    $headers = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=utf-8\r\n";
    $headers .= "From: " . SITE_NAME . " <" . $from . ">\r\n";
    //mail($to,$subject,$message,$headers);
    smtpmail($to, $subject, $message, $headers);
}
开发者ID:norayr,项目名称:paperbod,代码行数:10,代码来源:functions.php

示例6: send

 function send()
 {
     global $board_config, $lang, $phpEx, $phpbb_root_path, $db;
     // Escape all quotes, else the eval will fail.
     $this->msg = str_replace("'", "\\'", $this->msg);
     $this->msg = preg_replace('#\\{([a-z0-9\\-_]*?)\\}#is', "' . \$\\1 . '", $this->msg);
     // Set vars
     reset($this->vars);
     while (list($key, $val) = each($this->vars)) {
         ${$key} = $val;
     }
     eval("\$this->msg = '{$this->msg}';");
     // Clear vars
     reset($this->vars);
     while (list($key, $val) = each($this->vars)) {
         unset(${$key});
     }
     // We now try and pull a subject from the email body ... if it exists,
     // do this here because the subject may contain a variable
     $drop_header = '';
     $match = array();
     if (preg_match('#^(Subject:(.*?))$#m', $this->msg, $match)) {
         $this->subject = trim($match[2]) != '' ? trim($match[2]) : ($this->subject != '' ? $this->subject : 'No Subject');
         $drop_header .= '[\\r\\n]*?' . phpbb_preg_quote($match[1], '#');
     } else {
         $this->subject = $this->subject != '' ? $this->subject : 'No Subject';
     }
     if (preg_match('#^(Charset:(.*?))$#m', $this->msg, $match)) {
         $this->encoding = trim($match[2]) != '' ? trim($match[2]) : trim($lang['ENCODING']);
         $drop_header .= '[\\r\\n]*?' . phpbb_preg_quote($match[1], '#');
     } else {
         $this->encoding = trim($lang['ENCODING']);
     }
     if ($drop_header != '') {
         $this->msg = trim(preg_replace('#' . $drop_header . '#s', '', $this->msg));
     }
     $to = $this->addresses['to'];
     $cc = count($this->addresses['cc']) ? implode(', ', $this->addresses['cc']) : '';
     $bcc = count($this->addresses['bcc']) ? implode(', ', $this->addresses['bcc']) : '';
     // Build header
     $this->extra_headers = ($this->reply_to != '' ? "Reply-to: {$this->reply_to}\n" : '') . ($this->from != '' ? "From: {$this->from}\n" : "From: " . $board_config['board_email'] . "\n") . "Return-Path: " . $board_config['board_email'] . "\nMessage-ID: <" . md5(uniqid(time())) . "@" . $board_config['server_name'] . ">\nMIME-Version: 1.0\nContent-type: text/plain; charset=" . $this->encoding . "\nContent-transfer-encoding: 8bit\nDate: " . date('r', time()) . "\nX-Priority: 3\nX-MSMail-Priority: Normal\nX-Mailer: PHP\nX-MimeOLE: Produced By phpBB2\n" . $this->extra_headers . ($cc != '' ? "Cc: {$cc}\n" : '') . ($bcc != '' ? "Bcc: {$bcc}\n" : '');
     // Send message ... removed $this->encode() from subject for time being
     if ($this->use_smtp) {
         if (!defined('SMTP_INCLUDED')) {
             include $phpbb_root_path . 'includes/smtp.' . $phpEx;
         }
         $result = smtpmail($to, $this->subject, $this->msg, $this->extra_headers);
     } else {
         $empty_to_header = $to == '' ? TRUE : FALSE;
         $to = $to == '' ? $board_config['sendmail_fix'] ? ' ' : 'Undisclosed-recipients:;' : $to;
         $result = @mail($to, $this->subject, preg_replace("#(?<!\r)\n#s", "\n", $this->msg), $this->extra_headers);
         if (!$result && !$board_config['sendmail_fix'] && $empty_to_header) {
             $to = ' ';
             $sql = "UPDATE " . CONFIG_TABLE . " \n\t\t\t\t\tSET config_value = '1'\n\t\t\t\t\tWHERE config_name = 'sendmail_fix'";
             if (!$db->sql_query($sql)) {
                 message_die(GENERAL_ERROR, 'Unable to update config table', '', __LINE__, __FILE__, $sql);
             }
             $board_config['sendmail_fix'] = 1;
             $result = @mail($to, $this->subject, preg_replace("#(?<!\r)\n#s", "\n", $this->msg), $this->extra_headers);
         }
     }
     // Did it work?
     if (!$result) {
         message_die(GENERAL_ERROR, 'Failed sending email :: ' . ($this->use_smtp ? 'SMTP' : 'PHP') . ' :: ' . $result, '', __LINE__, __FILE__);
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:phpbbsfp,代码行数:67,代码来源:emailer.php

示例7: SetStatus

 /**
  * 
  * @global type $sqlcn
  * @global type $cfg
  * @param type $status
  */
 function SetStatus($status)
 {
     global $sqlcn, $cfg;
     if ($this->status != $status) {
         $url = $cfg->urlsite;
         $sqlcn->ExecuteSQL("UPDATE bp_xml SET status='{$status}' WHERE id='{$this->id}'", $cfg->base_id) or die('Неверный запрос Tbp_xml.SetStatus: ' . mysqli_error($sqlcn->idsqlconnection));
         $zz = new Tusers();
         $zz->GetById($this->userid);
         smtpmail($zz->email, "Изменился статус БП!", "Внимание! Зайдите на портал и посмотрите статус БП№ {$this->id} <br><a href={$url}/index.php?content_page=bp>{$this->title}</a>");
     }
 }
开发者ID:Kozlov-V,项目名称:webuseorg3,代码行数:17,代码来源:bp.php

示例8: send

 function send()
 {
     global $phpEx, $phpbb_root_dir;
     if (isset($phpbb_root_dir)) {
         // we must be in the admin section.
         $phpbb_root_path = $phpbb_root_dir;
     } else {
         $phpbb_root_path = "./";
     }
     if ($this->address == NULL) {
         message_die(GENERAL_ERROR, "No email address set", "", __LINE__, __FILE__);
     } else {
         if (!$this->parse_email()) {
             return FALSE;
         }
         if ($this->use_smtp) {
             if (!defined('SMTP_INCLUDED')) {
                 include $phpbb_root_path . "includes/smtp." . $phpEx;
             }
             if (!smtpmail($this->address, $this->subject, $this->msg, $this->extra_headers)) {
                 message_die(GENERAL_ERROR, "Sending via SMTP failed", "", __LINE__, __FILE__);
             }
         } else {
             @mail($this->address, $this->subject, $this->msg, $this->extra_headers);
         }
     }
     return TRUE;
 }
开发者ID:noikiy,项目名称:owaspbwa,代码行数:28,代码来源:emailer.php

示例9: process

 /**
  * Process queue
  * Using lock file
  */
 function process()
 {
     global $db, $config, $phpEx, $phpbb_root_path, $user;
     $lock = new \phpbb\lock\flock($this->cache_file);
     $lock->acquire();
     // avoid races, check file existence once
     $have_cache_file = file_exists($this->cache_file);
     if (!$have_cache_file || $config['last_queue_run'] > time() - $config['queue_interval']) {
         if (!$have_cache_file) {
             set_config('last_queue_run', time(), true);
         }
         $lock->release();
         return;
     }
     set_config('last_queue_run', time(), true);
     include $this->cache_file;
     foreach ($this->queue_data as $object => $data_ary) {
         @set_time_limit(0);
         if (!isset($data_ary['package_size'])) {
             $data_ary['package_size'] = 0;
         }
         $package_size = $data_ary['package_size'];
         $num_items = !$package_size || sizeof($data_ary['data']) < $package_size ? sizeof($data_ary['data']) : $package_size;
         /*
         * This code is commented out because it causes problems on some web hosts.
         * The core problem is rather restrictive email sending limits.
         * This code is nly useful if you have no such restrictions from the
         * web host and the package size setting is wrong.
         
         // If the amount of emails to be sent is way more than package_size than we need to increase it to prevent backlogs...
         if (sizeof($data_ary['data']) > $package_size * 2.5)
         {
         	$num_items = sizeof($data_ary['data']);
         }
         */
         switch ($object) {
             case 'email':
                 // Delete the email queued objects if mailing is disabled
                 if (!$config['email_enable']) {
                     unset($this->queue_data['email']);
                     continue 2;
                 }
                 break;
             case 'jabber':
                 if (!$config['jab_enable']) {
                     unset($this->queue_data['jabber']);
                     continue 2;
                 }
                 include_once $phpbb_root_path . 'includes/functions_jabber.' . $phpEx;
                 $this->jabber = new jabber($config['jab_host'], $config['jab_port'], $config['jab_username'], htmlspecialchars_decode($config['jab_password']), $config['jab_use_ssl']);
                 if (!$this->jabber->connect()) {
                     $messenger = new messenger();
                     $messenger->error('JABBER', $user->lang['ERR_JAB_CONNECT']);
                     continue 2;
                 }
                 if (!$this->jabber->login()) {
                     $messenger = new messenger();
                     $messenger->error('JABBER', $user->lang['ERR_JAB_AUTH']);
                     continue 2;
                 }
                 break;
             default:
                 $lock->release();
                 return;
         }
         for ($i = 0; $i < $num_items; $i++) {
             // Make variables available...
             extract(array_shift($this->queue_data[$object]['data']));
             switch ($object) {
                 case 'email':
                     $err_msg = '';
                     $to = !$to ? 'undisclosed-recipients:;' : $to;
                     if ($config['smtp_delivery']) {
                         $result = smtpmail($addresses, mail_encode($subject), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $err_msg, $headers);
                     } else {
                         $result = phpbb_mail($to, $subject, $msg, $headers, $this->eol, $err_msg);
                     }
                     if (!$result) {
                         $messenger = new messenger();
                         $messenger->error('EMAIL', $err_msg);
                         continue 2;
                     }
                     break;
                 case 'jabber':
                     foreach ($addresses as $address) {
                         if ($this->jabber->send_message($address, $msg, $subject) === false) {
                             $messenger = new messenger();
                             $messenger->error('JABBER', $this->jabber->get_log());
                             continue 3;
                         }
                     }
                     break;
             }
         }
         // No more data for this object? Unset it
         if (!sizeof($this->queue_data[$object]['data'])) {
//.........这里部分代码省略.........
开发者ID:mysteriou,项目名称:educafacile.com,代码行数:101,代码来源:functions_messenger.php

示例10: send

 /**
  * Sends the mail.
  */
 function send($to_name, $to_addr, $from_name, $from_addr, $subject = '', $headers = '')
 {
     $to = $to_name != '' ? '"' . $to_name . '" <' . $to_addr . '>' : $to_addr;
     $from = $from_name != '' ? '"' . $from_name . '" <' . $from_addr . '>' : $from_addr;
     if (is_string($headers)) {
         $headers = explode($this->lf, trim($headers));
     }
     for ($i = 0, $n = count($headers); $i < $n; $i++) {
         if (is_array($headers[$i])) {
             for ($j = 0, $nn = count($headers[$i]); $j < $nn; $j++) {
                 if ($headers[$i][$j] != '') {
                     $xtra_headers[] = $headers[$i][$j];
                 }
             }
         }
         if ($headers[$i] != '') {
             $xtra_headers[] = $headers[$i];
         }
     }
     if (!isset($xtra_headers)) {
         $xtra_headers = array();
     }
     //die(EMAIL_TRANSPORT);
     switch (EMAIL_TRANSPORT) {
         case 'smtp':
             $headers_list = 'From: ' . $from . $this->lf;
             $headers_list .= 'To: ' . $to . $this->lf;
             $headers_list .= implode($this->lf, $this->headers) . $this->lf;
             $headers_list .= implode($this->lf, $xtra_headers);
             if (EMAIL_FRIENDLY_ERRORS == 'true') {
                 return @mail($to_addr, $subject, preg_replace("#(?<!\r)\n#s", "\r\n", $this->output), $headers_list);
             } else {
                 return mail($to_addr, $subject, preg_replace("#(?<!\r)\n#s", "\r\n", $this->output), $headers_list);
             }
             break;
         case 'smtpauth':
             $tz = date("Z");
             $tzs = $tz < 0 ? "-" : "+";
             $tz = abs($tz);
             $tz = $tz / 3600 * 100 + $tz % 3600 / 60;
             $datum = sprintf("%s %s%04d", date("D, j M Y H:i:s"), $tzs, $tz);
             $headers_list = 'From: ' . $from . $this->lf;
             //        $headers_list .= 'To: ' . $to . $this->lf;
             $headers_list .= "Reply-To: " . $from . $this->lf;
             $headers_list .= "Date: " . $datum . $this->lf;
             $headers_list .= implode($this->lf, $this->headers) . $this->lf;
             $headers_list .= implode($this->lf, $xtra_headers);
             return smtpmail($to_addr, $subject, preg_replace("#(?<!\r)\n#s", "\r\n", $this->output), $headers_list);
             break;
         case 'sendmail-f':
             $headers_list = 'From: ' . $from . $this->lf;
             $headers_list .= implode($this->lf, $this->headers) . $this->lf;
             $headers_list .= implode($this->lf, $xtra_headers);
             if (EMAIL_FRIENDLY_ERRORS == 'true') {
                 return @mail($to, $subject, preg_replace("#(?<!\r)\n#s", "\r\n", $this->output), $headers_list, "-f" . $from);
             } else {
                 return mail($to, $subject, preg_replace("#(?<!\r)\n#s", "\r\n", $this->output), $headers_list, "-f" . $from);
             }
             break;
         case 'sendmail':
         default:
             $headers_list = 'From: ' . $from . $this->lf;
             $headers_list .= implode($this->lf, $this->headers) . $this->lf;
             $headers_list .= implode($this->lf, $xtra_headers);
             if (EMAIL_FRIENDLY_ERRORS == 'true') {
                 return @mail($to, $subject, preg_replace("#(?<!\r)\n#s", "\r\n", $this->output), $headers_list);
             } else {
                 return mail($to, $subject, preg_replace("#(?<!\r)\n#s", "\r\n", $this->output), $headers_list);
             }
             break;
     }
 }
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:75,代码来源:email.php

示例11: basename

        $f2 = @fopen($put_k_failu2, "rb");
        $telo_pisma_fail = "------------" . $un . "\nContent-Type: " . $zag_type . "; Charset=UTF-8" . $end_zag;
        $telo_pisma_fail .= "Content-Transfer-Encoding: 8bit" . $end_zag . $end_zag . "{$telo_pisma}" . $end_zag;
        if (isset($put_k_failu)) {
            $telo_pisma_fail .= "------------" . $un . $end_zag;
            $telo_pisma_fail .= "Content-Type: application/octet-stream; name=\"" . basename($name_fail) . "\"" . $end_zag;
            $telo_pisma_fail .= "Content-Transfer-Encoding: base64" . $end_zag;
            $telo_pisma_fail .= "Content-Disposition: attachment; filename=\"" . basename($name_fail) . "\"" . $end_zag . $end_zag;
            $telo_pisma_fail .= chunk_split(base64_encode(fread($f, filesize($put_k_failu))));
        }
        if (isset($put_k_failu2)) {
            $telo_pisma_fail .= $end_zag . "------------" . $un . $end_zag;
            $telo_pisma_fail .= "Content-Type: application/octet-stream; name=\"" . basename($name_fail2) . "\"" . $end_zag;
            $telo_pisma_fail .= "Content-Transfer-Encoding: base64\n";
            $telo_pisma_fail .= "Content-Disposition: attachment; filename=\"" . basename($name_fail2) . "\"" . $end_zag . $end_zag;
            $telo_pisma_fail .= chunk_split(base64_encode(fread($f2, filesize($put_k_failu2))));
        }
        $telo_pisma_fail .= "------------" . $un . "--";
        $telo_pisma = $telo_pisma_fail;
    }
    if ($sposob_otp == "true") {
        $return = smtpmail($smtp_host, $smtp_port, $smtp_login, $smtp_passw, $email_polucha, $telo_pisma, $headers);
    } else {
        $return = mail($email_polucha, $tema_pisma, $telo_pisma, $headers);
    }
    if ($return == true) {
        echo "true";
    } else {
        echo "false";
    }
}
开发者ID:Aluxian,项目名称:DroidHub,代码行数:31,代码来源:wiqi.php

示例12: send

 function send($to)
 {
     global $use_smtp, $phpExt;
     if (!$use_smtp) {
         $result = @mail($to, $this->subject, ' ', $this->_build());
     } else {
         if (!defined('SMTP_INCLUDED')) {
             include 'include/smtp.' . $phpExt;
         }
         $result = smtpmail($to, $this->subject, ' ', $this->_build());
     }
     return $result;
 }
开发者ID:iesportada,项目名称:intranet,代码行数:13,代码来源:functions.php

示例13: smtpmassmail

function smtpmassmail($mail_to, $subject, $message, $headers = '')
{
    $mailaddresses = explode(",", $mail_to);
    foreach ($mailaddresses as $mailaddress) {
        smtpmail($mailaddress, $subject, $message, $headers);
    }
}
开发者ID:MrVladevoit,项目名称:shofacademy,代码行数:7,代码来源:smtp-func.php

示例14: explode

    }
}
if ($export_file !== '') {
    $vars = explode(',', $export_fields);
    $str_arr[] = '"' . date("d.m.y H:i:s") . '"';
    foreach ($vars as $var_name) {
        if (isset($_POST[$var_name])) {
            $str_arr[] = '"' . $_POST[$var_name] . '"';
        }
    }
    file_put_contents($export_file, implode(';', $str_arr) . "\n", FILE_APPEND | LOCK_EX);
}
smtpmail($email, $subject, $message . '<br>' . $fields);
if ($client_email !== '') {
    $client_message === '' ? $message .= '<br>' . $fields : ($message = $client_message);
    smtpmail($_POST[$client_email], $subject, $message, true);
}
function smtpmail($to, $subject, $content, $client_mode = false)
{
    global $success, $smtp, $host, $auth, $secure, $port, $username, $password, $from, $addreply, $charset, $cc, $bcc, $client_email, $client_message, $client_file;
    require_once './class-phpmailer.php';
    $mail = new PHPMailer(true);
    if ($smtp) {
        $mail->IsSMTP();
    }
    try {
        $mail->SMTPDebug = 0;
        $mail->Host = $host;
        $mail->SMTPAuth = $auth;
        $mail->SMTPSecure = $secure;
        $mail->Port = $port;
开发者ID:vitaly-zdanevich,项目名称:dreamvisa-by,代码行数:31,代码来源:mail.php

示例15: process

 function process()
 {
     global $site_file_root, $config;
     set_config('last_queue_run', time(), true);
     // Delete stale lock file
     if (file_exists($this->cache_file . '.lock') && !file_exists($this->cache_file)) {
         @unlink($this->cache_file . '.lock');
         return;
     }
     if (!file_exists($this->cache_file) || file_exists($this->cache_file . '.lock') && filemtime($this->cache_file) > time() - $config['queue_interval']) {
         return;
     }
     $fp = @fopen($this->cache_file . '.lock', 'wb');
     fclose($fp);
     include $this->cache_file;
     foreach ($this->queue_data as $object => $data_ary) {
         @set_time_limit(60);
         $package_size = $data_ary['package_size'];
         $num_items = sizeof($data_ary['data']) < $package_size ? sizeof($data_ary['data']) : $package_size;
         switch ($object) {
             case 'email':
                 // Delete the email queued objects if mailing is disabled
                 if (!$config['email_enable']) {
                     unset($this->queue_data['email']);
                     continue 2;
                 }
                 break;
             case 'jabber':
                 if (!$config['jab_enable']) {
                     unset($this->queue_data['jabber']);
                     continue 2;
                 }
                 require_once $site_file_root . 'includes/forums/functions_jabber.php';
                 $this->jabber = new jabber();
                 $this->jabber->server = $config['jab_host'];
                 $this->jabber->port = $config['jab_port'] ? $config['jab_port'] : 5222;
                 $this->jabber->username = $config['jab_username'];
                 $this->jabber->password = $config['jab_password'];
                 $this->jabber->resource = $config['jab_resource'] ? $config['jab_resource'] : '';
                 if (!$this->jabber->connect()) {
                     messenger::error('JABBER', 'Could not connect to Jabber server');
                     continue 2;
                 }
                 if (!$this->jabber->send_auth()) {
                     messenger::error('JABBER', 'Could not authorise on Jabber server');
                     continue 2;
                 }
                 $this->jabber->send_presence(NULL, NULL, 'online');
                 break;
             default:
                 return;
         }
         for ($i = 0; $i < $num_items; $i++) {
             extract(array_shift($this->queue_data[$object]['data']));
             switch ($object) {
                 case 'email':
                     $err_msg = '';
                     $to = !$to ? 'Undisclosed-Recipient:;' : $to;
                     $result = $config['smtp_delivery'] ? smtpmail($addresses, $subject, wordwrap($msg), $err_msg, $encoding, $headers) : @$config['email_function_name']($to, $subject, implode("\n", preg_split("/\r?\n/", wordwrap($msg))), $headers);
                     if (!$result) {
                         @unlink($this->cache_file . '.lock');
                         $message = 'Method: [ ' . ($config['smtp_delivery'] ? 'SMTP' : 'PHP') . ' ]<br /><br />' . $err_msg . '<br /><br /><u>CALLING PAGE</u><br /><br />' . (!empty($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_ENV['PHP_SELF']);
                         messenger::error('MAIL', $message);
                         continue 3;
                     }
                     break;
                 case 'jabber':
                     foreach ($addresses as $address) {
                         $this->jabber->send_message($address, 'normal', NULL, array('body' => $msg));
                     }
                     break;
             }
         }
         // No more data for this object? Unset it
         if (!sizeof($this->queue_data[$object]['data'])) {
             unset($this->queue_data[$object]);
         }
         // Post-object processing
         switch ($object) {
             case 'jabber':
                 // Hang about a couple of secs to ensure the messages are
                 // handled, then disconnect
                 sleep(1);
                 $this->jabber->disconnect();
                 break;
         }
     }
     if (!sizeof($this->queue_data)) {
         @unlink($this->cache_file);
     } else {
         $file = '<?php $this->queue_data=' . $this->format_array($this->queue_data) . '; ?>';
         if ($fp = @fopen($this->cache_file, 'w')) {
             @flock($fp, LOCK_EX);
             fwrite($fp, $file);
             @flock($fp, LOCK_UN);
             fclose($fp);
         }
     }
     @unlink($this->cache_file . '.lock');
 }
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:100,代码来源:functions_messenger.php


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