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


PHP POP3类代码示例

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


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

示例1: zenphoto_PHPMailer

function zenphoto_PHPMailer($msg, $email_list, $subject, $message, $from_mail, $from_name, $cc_addresses, $replyTo, $html = false)
{
    require_once dirname(__FILE__) . '/PHPMailer/class.phpmailer.php';
    switch (getOption('PHPMailer_mail_protocol')) {
        case 'pop3':
            require_once dirname(__FILE__) . '/PHPMailer/class.pop3.php';
            $pop = new POP3();
            $authorized = $pop->Authorise(getOption('PHPMailer_server'), getOption('PHPMailer_pop_port'), 30, getOption('PHPMailer_user'), getOption('PHPMailer_password'), 0);
            $mail = new PHPMailer();
            $mail->IsSMTP();
            $mail->Port = getOption('PHPMailer_smtp_port');
            $mail->Host = getOption('PHPMailer_server');
            break;
        case 'smtp':
            $mail = new PHPMailer();
            $mail->SMTPAuth = true;
            // enable SMTP authentication
            $mail->IsSMTP();
            $mail->Username = getOption('PHPMailer_user');
            $mail->Password = getOption('PHPMailer_password');
            $mail->Host = getOption('PHPMailer_server');
            $mail->Port = getOption('PHPMailer_smtp_port');
            break;
        case 'sendmail':
            $mail = new PHPMailer();
            $mail->IsSendmail();
            break;
    }
    $mail->SMTPSecure = getOption('PHPMailer_secure');
    $mail->CharSet = 'UTF-8';
    $mail->From = $from_mail;
    $mail->FromName = $from_name;
    $mail->Subject = $subject;
    $mail->Body = $message;
    $mail->AltBody = '';
    $mail->IsHTML($html);
    foreach ($email_list as $to_name => $to_mail) {
        if (is_numeric($to_name)) {
            $mail->AddAddress($to_mail);
        } else {
            $mail->AddAddress($to_mail, $to_name);
        }
    }
    if (count($cc_addresses) > 0) {
        foreach ($cc_addresses as $cc_name => $cc_mail) {
            $mail->AddCC($cc_mail);
        }
    }
    if ($replyTo) {
        $names = array_keys($replyTo);
        $mail->AddReplyTo(array_shift($replyTo), array_shift($names));
    }
    if (!$mail->Send()) {
        if (!empty($msg)) {
            $msg .= '<br />';
        }
        $msg .= sprintf(gettext('<code>PHPMailer</code> failed to send <em>%1$s</em>. ErrorInfo:%2$s'), $subject, $mail->ErrorInfo);
    }
    return $msg;
}
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:60,代码来源:PHPMailer.php

示例2: SendMail

 function SendMail($toAddress, $toName, $subject, $messageBody, $bcc = NULL, $mailList = FALSE)
 {
     require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Config/Main.php";
     if ($mailList) {
         require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Config/MailService2.php";
     } else {
         require $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Config/MailService.php";
     }
     require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/PHPMailer/class.phpmailer.php";
     require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/PHPMailer/class.pop3.php";
     if ($MailServiceAuthPOP3) {
         $pop = new POP3();
         $pop->Authorise($MailServicePOP3Addr, $MailServicePOP3Port, 30, $MailServiceSMTPUser, $MailServiceSMTPPass, $MailServicePOPDebug);
     }
     $mail = new PHPMailer();
     if ($MailServiceMailerLang != "en") {
         $mail->SetLanguage($MailServiceMailerLang, $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/PHPMailer/language/");
     }
     $mail->IsSMTP();
     $mail->SMTPDebug = $MailServiceSMTPDebug;
     $mail->Port = $MailServiceSMTPPort;
     $mail->SMTPSecure = $MailServiceEncrypt;
     $mail->Host = $MailServiceSMTPAddr;
     $mail->SMTPAuth = $MailServiceAuthSMTP;
     $mail->Username = $MailServiceSMTPUser;
     $mail->Password = $MailServiceSMTPPass;
     $mail->From = $MailServiceFromMail;
     $mail->FromName = $MailServiceFromName;
     $mail->AddAddress($toAddress, $toName);
     if ($bcc != NULL) {
         if (is_array($bcc)) {
             foreach ($bcc as $key => $value) {
                 $mail->AddBCC($value);
             }
         }
     }
     $mail->WordWrap = 50;
     $mail->CharSet = $MailServiceMsgCharset;
     $mail->IsHTML(true);
     $mail->Subject = $subject;
     $mail->Body = $messageBody;
     if ($mail->Send()) {
         return true;
     } else {
         return $mail->ErrorInfo;
     }
 }
开发者ID:BieeeLC,项目名称:OpenWeb,代码行数:47,代码来源:Mail.class.php

示例3: sendMail

function sendMail($_msubject, $_mbody, $_mto, $_mname)
{
    global $SMTP_FROMNAME;
    $pop = new POP3();
    $pop->Authorise('envasadoras.com.mx', 110, 30, 't&e-hod', 'tyeh2014', 1);
    $mail = new PHPMailer();
    //Luego tenemos que iniciar la validación por SMTP:
    $mail->IsSMTP();
    $mail->SMTPAuth = true;
    $mail->Host = "envasadoras.com.mx";
    // SMTP a utilizar. Por ej. smtp.elserver.com
    //$mail->Username = "t&e-hod"; // Correo completo a utilizar
    //$mail->Password = "tyeh2014"; // Contraseña
    $mail->Port = 25;
    // Puerto a utilizar
    $mail->From = "t&e-hod@envasadoras.com.mx";
    // Desde donde enviamos (Para mostrar)
    $mail->FromName = "Sistema de Gastos de Viaje";
    $cnt = 0;
    if (stristr($_mto, ",") === FALSE) {
        //EVALUAMOS SI TIENE , PARA SACAR A LOS USUARIOS QUE SE MANDARA EL MAIL :)
        $mail->AddAddress($_mto, $_mname);
    } else {
        $aux = explode(",", $_mto);
        foreach ($aux as $direccion) {
            $mail->AddAddress(trim($direccion), $_mname);
            $cnt++;
        }
    }
    $mail->WordWrap = 50;
    // set word wrap
    $mail->IsHTML(TRUE);
    // send as HTML
    $mail->Subject = $_msubject;
    $mail->Body = $_mbody;
    if (!$mail->Send()) {
        echo "Mailer Error: " . $mail->ErrorInfo;
        return -1;
    }
    return 0;
    //echo "    Mensaje Enviado.\n";
}
开发者ID:hackdracko,项目名称:envasadoras,代码行数:42,代码来源:mail.php

示例4: action_index

 public function action_index()
 {
     if (!empty($_REQUEST["f_rename"])) {
         if ($this->model->valid($_POST["f_mail"], $_POST["f_login"]) > 0) {
             $maincfg = Configs::readCfg("main", tbuild);
             if ($maincfg["usemd5"] == 0) {
                 $pwd = $this->model->viewPwd($_POST["f_login"]);
             } else {
                 $pwd = $this->model->getNewPwd($_POST["f_login"], 1);
             }
             if ($this->configs["useMail"] != 1) {
                 echo "<script>alert('password is: {$pwd}');</script>";
             } else {
                 $c_mail = Configs::readCfg("mail", tbuild);
                 require "libraries/PHPMailer/PHPMailerAutoload.php";
                 $pop = new POP3();
                 $pop->Authorise($c_mail["mailhost"], $c_mail["mailport"], $c_mail["mailtmout"], $c_mail["mailboxf"], $c_mail["mailpbf"], $c_mail["maildlvl"]);
                 $mail = new PHPMailer();
                 $mail->CharSet = "UTF-8";
                 $mail->Host = $c_mail["mailhost"];
                 $mail->SMTPAuth = true;
                 $mail->Username = $c_mail["mailboxf"];
                 $mail->Password = $c_mail["mailpbf"];
                 $mail->SetFrom($c_mail["mailboxf"], $c_mail["mailnamefrom"]);
                 $mail->AddReplyTo($c_mail["mailboxf"], $c_mail["mailnib"]);
                 $mail->Subject = "Register";
                 $mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
                 // optional, comment out and test
                 $this->view->set("fl_login", $_POST["f_login"])->set("fl_pwd", $pwd);
                 $mail->MsgHTML($this->view->out("register", "mail", 2));
                 $mail->AddAddress($_POST['f_mail']);
                 if (!$mail->Send()) {
                     $this->model->toLog("Mail error:" . $mail->ErrorInfo, "register", 13);
                 }
                 echo "<script>alert('Password was send to your e-mail');</script>";
             }
         }
     }
     $this->view->out("forgotpwd");
 }
开发者ID:SanneA,项目名称:wodegongjubao,代码行数:40,代码来源:forgotpwd.php

示例5: POP3MessageFetch

/**
 * Retrieves email via POP3
 */
function POP3MessageFetch($server = NULL, $port = NULL, $email = NULL, $password = NULL, $protocol = NULL, $offset = NULL, $test = NULL, $deleteMessages = true, $maxemails = 0)
{
    require_once ABSPATH . WPINC . DIRECTORY_SEPARATOR . 'class-pop3.php';
    $emails = array();
    $pop3 = new POP3();
    if (defined('POSTIE_DEBUG')) {
        $pop3->DEBUG = POSTIE_DEBUG;
    }
    DebugEcho("Connecting to {$server}:{$port} ({$protocol})");
    if ($pop3->connect(trim($server), $port)) {
        $msg_count = $pop3->login($email, $password);
        if ($msg_count === false) {
            $msg_count = 0;
        }
    } else {
        if (strpos($pop3->ERROR, "POP3: premature NOOP OK, NOT an RFC 1939 Compliant server") === false) {
            EchoInfo("Mail Connection Time Out. Common Reasons: Server Down, Network Issue, Port/Protocol MisMatch");
        }
        EchoInfo("The Server said: {$pop3->ERROR}");
        $msg_count = 0;
    }
    DebugEcho("message count: {$msg_count}");
    // loop through messages
    //$msgs = $pop3->pop_list();
    //DebugEcho("POP3MessageFetch: messages");
    //DebugDump($msgs);
    for ($i = 1; $i <= $msg_count; $i++) {
        $m = $pop3->get($i);
        if ($m !== false) {
            if (is_array($m)) {
                $emails[$i] = implode('', $m);
                if ($deleteMessages) {
                    if (!$pop3->delete($i)) {
                        EchoInfo('POP3MessageFetch: cannot delete message $i ' . $pop3->ERROR);
                        $pop3->reset();
                        exit;
                    }
                }
            } else {
                DebugEcho("POP3MessageFetch: message {$i} not an array");
            }
        } else {
            EchoInfo("POP3MessageFetch: message {$i} {$pop3->ERROR}");
        }
        if ($maxemails != 0 && $i >= $maxemails) {
            DebugEcho("Max emails ({$maxemails})");
            break;
        }
    }
    //clean up
    $pop3->quit();
    return $emails;
}
开发者ID:donwea,项目名称:nhap.org,代码行数:56,代码来源:postie-functions.php

示例6: POP3

$db["addr"] = "localhost";
$db["user"] = "";
$db["pass"] = "";
$db["link"] = FALSE;
$db["use"] = "mail";
// optional
$db["dir_table"] = "inbox";
// Table for header data
$db["msg_table"] = "messages";
// Table for complete Messages (/w header)...
// Your own free Vars
// Save to MySQL ??
$savetomysql = TRUE;
$savetofile = TRUE;
$delete = FALSE;
$pop3 = new POP3($log, $log_file, $apop_detect);
if ($pop3->connect($server)) {
    if ($pop3->login($username, $password)) {
        if (!($msg_list = $pop3->get_office_status())) {
            echo $pop3->error;
            return;
        }
    } else {
        echo $pop3->error;
        return;
    }
} else {
    echo $pop3->error;
    return;
}
$db["link"] = mysql_connect($db["addr"], $db["user"], $db["pass"]) or die(mysql_error());
开发者ID:Webysther,项目名称:pop3,代码行数:31,代码来源:pop3_test.php

示例7: testPopBeforeSmtpBad

 /**
  * Use a fake POP3 server to test POP-before-SMTP auth
  * With a known-bad login
  */
 public function testPopBeforeSmtpBad()
 {
     //Start a fake POP server on a different port
     //so we don't inadvertently connect to the previous instance
     $pid = shell_exec('nohup ./runfakepopserver.sh 1101 >/dev/null 2>/dev/null & printf "%u" $!');
     $this->pids[] = $pid;
     sleep(2);
     //Test a known-bad login
     $this->assertFalse(POP3::popBeforeSmtp('localhost', 1101, 10, 'user', 'xxx', $this->Mail->SMTPDebug), 'POP before SMTP should have failed');
     shell_exec('kill -TERM ' . escapeshellarg($pid));
     sleep(2);
 }
开发者ID:rkenterprisesgroup,项目名称:rkenterprisesgroup.github.io,代码行数:16,代码来源:phpmailerTest.php

示例8: wp_mail_receive

function wp_mail_receive()
{
    global $wpdb, $wp_pop3, $img_target;
    require_once ABSPATH . WPINC . '/class-pop3.php';
    timer_start();
    $use_cache = 1;
    $time_difference = get_settings('time_difference');
    $blog_charset = get_settings('blog_charset');
    error_reporting(2037);
    $wp_pop3 = new POP3();
    if (!$wp_pop3->connect(get_settings('mailserver_url'), get_settings('mailserver_port'))) {
        echo "Ooops {$wp_pop3->ERROR} <br />\n";
        return;
    }
    $mail_count = $wp_pop3->login(get_settings('mailserver_login'), get_settings('mailserver_pass'));
    if ($mail_count == false) {
        if (!$wp_pop3->FP) {
            echo "Oooops Login Failed: {$wp_pop3->ERROR}<br />\n";
        } else {
            echo "No Message<br />\n";
            $wp_pop3->quit();
        }
        return;
    }
    // ONLY USE THIS IF YOUR PHP VERSION SUPPORTS IT!
    register_shutdown_function('wp_mail_quit');
    for ($mail_num = 1; $mail_num <= $mail_count; $mail_num++) {
        $MsgOne = $wp_pop3->get($mail_num);
        if (!$MsgOne || gettype($MsgOne) != 'array') {
            echo "oops, {$wp_pop3->ERROR}<br />\n";
            $wp_pop3->quit();
            return;
        }
        $content = '';
        $content_type = '';
        $boundary = '';
        $att_boundary = '';
        $hatt_boundary = '';
        $bodysignal = 0;
        $dmonths = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
        while (list($lineNum, $line) = each($MsgOne)) {
            if (strlen($line) < 3) {
                $bodysignal = 1;
            }
            if ($bodysignal) {
                $content .= $line;
            } else {
                if (preg_match('/^Content-Type:\\s+(.*?)\\;/i', $line, $match)) {
                    $content_type = $match[1];
                    $content_type = strtolower($match[1]);
                }
                if ($content_type == 'multipart/mixed' && preg_match('/boundary=(?:")?([^;"\\s\\n]*?)(?:")?\\s*(?:$|;)/', $line, $match) && $att_boundary == '') {
                    $att_boundary = trim($match[1]);
                }
                if ($content_type == 'multipart/alternative' && preg_match('/boundary=(?:")?([^;"\\s\\n]*?)(?:")?\\s*(?:$|;)/', $line, $match) && $boundary == '') {
                    $boundary = trim($match[1]);
                }
                if ($content_type == 'multipart/related' && preg_match('/boundary=(?:")?([^;"\\s\\n]*?)(?:")?\\s*(?:$|;)/', $line, $match) && $hatt_boundary == '') {
                    $hatt_boundary = trim($match[1]);
                }
                if (preg_match('/Subject: /', $line)) {
                    $subject = trim($line);
                    $subject = substr($subject, 9, strlen($subject) - 9);
                    if (function_exists('mb_decode_mimeheader')) {
                        $subject1 = mb_decode_mimeheader($subject);
                        if ($subject != $subject) {
                            $sub_charset = mb_internal_encoding();
                        } else {
                            $sub_charset = "auto";
                        }
                        $subject = $subject1;
                    }
                    if (get_settings('use_phoneemail')) {
                        $subject = explode(get_settings('phoneemail_separator'), $subject);
                        $subject = trim($subject[0]);
                    }
                }
                if (preg_match('/Date: /', $line)) {
                    // of the form '20 Mar 2002 20:32:37'
                    $ddate = trim($line);
                    $ddate = str_replace('Date: ', '', $ddate);
                    if (strpos($ddate, ',')) {
                        $ddate = trim(substr($ddate, strpos($ddate, ',') + 1, strlen($ddate)));
                    }
                    $ddate_U = strtotime($ddate) + $time_difference * 3600;
                    $post_date = date('Y-m-d H:i:s', $ddate_U);
                }
            }
        }
        if (!ereg(get_settings('subjectprefix'), $subject)) {
            continue;
        }
        $charset = "";
        $ncharset = preg_match("/\\s?charset=\"?([A-Za-z0-9\\-]*)\"?/i", $content, $matches);
        if ($ncharset) {
            $charset = $matches[1];
        }
        $ddate_today = time() + $time_difference * 3600;
        $ddate_difference_days = ($ddate_today - $ddate_U) / 86400;
        if ($ddate_difference_days > 14) {
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:101,代码来源:wp-mail.php

示例9: PHPMailer

<?php

/**
 * This example shows how to use POP-before-SMTP for authentication.
 */
require '../PHPMailerAutoload.php';
//Authenticate via POP3.
//After this you should be allowed to submit messages over SMTP for a while.
//Only applies if your host supports POP-before-SMTP.
$pop = POP3::popBeforeSmtp('pop3.example.com', 110, 30, 'username', 'password', 1);
//Create a new PHPMailer instance
//Passing true to the constructor enables the use of exceptions for error handling
$mail = new PHPMailer(true);
try {
    $mail->isSMTP();
    //Enable SMTP debugging
    // 0 = off (for production use)
    // 1 = client messages
    // 2 = client and server messages
    $mail->SMTPDebug = 2;
    //Ask for HTML-friendly debug output
    $mail->Debugoutput = 'html';
    //Set the hostname of the mail server
    $mail->Host = "mail.example.com";
    //Set the SMTP port number - likely to be 25, 465 or 587
    $mail->Port = 25;
    //Whether to use SMTP authentication
    $mail->SMTPAuth = false;
    //Set who the message is to be sent from
    $mail->setFrom('from@example.com', 'First Last');
    //Set an alternative reply-to address
开发者ID:CloudNumericalCalculation,项目名称:cloudcalc-web,代码行数:31,代码来源:pop_before_smtp.php

示例10: osc_sendMail

function osc_sendMail($params)
{
    if (key_exists('add_bcc', $params)) {
        if (!is_array($params['add_bcc']) && $params['add_bcc'] != '') {
            $params['add_bcc'] = array($params['add_bcc']);
        }
    }
    require_once osc_lib_path() . 'phpmailer/class.phpmailer.php';
    if (osc_mailserver_pop()) {
        require_once osc_lib_path() . 'phpmailer/class.pop3.php';
        $pop = new POP3();
        $pop->Authorise(isset($params['host']) ? $params['host'] : osc_mailserver_host(), isset($params['port']) ? $params['port'] : osc_mailserver_port(), 30, isset($params['username']) ? $params['username'] : osc_mailserver_username(), isset($params['username']) ? $params['username'] : osc_mailserver_username(), 0);
    }
    $mail = new PHPMailer(true);
    try {
        $mail->CharSet = 'utf-8';
        if (osc_mailserver_auth()) {
            $mail->IsSMTP();
            $mail->SMTPAuth = true;
        } else {
            if (osc_mailserver_pop()) {
                $mail->IsSMTP();
            }
        }
        $mail->SMTPSecure = isset($params['ssl']) ? $params['ssl'] : osc_mailserver_ssl();
        $mail->Username = isset($params['username']) ? $params['username'] : osc_mailserver_username();
        $mail->Password = isset($params['password']) ? $params['password'] : osc_mailserver_password();
        $mail->Host = isset($params['host']) ? $params['host'] : osc_mailserver_host();
        $mail->Port = isset($params['port']) ? $params['port'] : osc_mailserver_port();
        $mail->From = isset($params['from']) ? $params['from'] : osc_contact_email();
        $mail->FromName = isset($params['from_name']) ? $params['from_name'] : osc_page_title();
        $mail->Subject = isset($params['subject']) ? $params['subject'] : '';
        $mail->Body = isset($params['body']) ? $params['body'] : '';
        $mail->AltBody = isset($params['alt_body']) ? $params['alt_body'] : '';
        $to = isset($params['to']) ? $params['to'] : '';
        $to_name = isset($params['to_name']) ? $params['to_name'] : '';
        if (key_exists('add_bcc', $params)) {
            foreach ($params['add_bcc'] as $bcc) {
                $mail->AddBCC($bcc);
            }
        }
        if (isset($params['reply_to'])) {
            $mail->AddReplyTo($params['reply_to']);
        }
        if (isset($params['attachment'])) {
            $mail->AddAttachment($params['attachment']);
        }
        $mail->IsHTML(true);
        $mail->AddAddress($to, $to_name);
        $mail->Send();
        return true;
    } catch (phpmailerException $e) {
        error_log("phpmailerException in osc_sendMail() Error: " . $mail->ErrorInfo, 0);
        return false;
    } catch (Exception $e) {
        error_log("Exception in osc_sendMail() Error" . $mail->ErrorInfo, 0);
        return false;
    }
    return false;
}
开发者ID:ricktaylord,项目名称:OSClass,代码行数:60,代码来源:utils.php

示例11: _sendEmail

 /**
  * @param UserModel  $user
  * @param EmailModel $emailModel
  * @param array      $variables
  *
  * @throws Exception
  * @return bool
  */
 private function _sendEmail(UserModel $user, EmailModel $emailModel, $variables = array())
 {
     // Get the saved email settings.
     $emailSettings = $this->getSettings();
     if (!isset($emailSettings['protocol'])) {
         throw new Exception(Craft::t('Could not determine how to send the email.  Check your email settings.'));
     }
     // Fire an 'onBeforeSendEmail' event
     $event = new Event($this, array('user' => $user, 'emailModel' => $emailModel, 'variables' => $variables));
     $this->onBeforeSendEmail($event);
     // Is the event giving us the go-ahead?
     if ($event->performAction) {
         // In case a plugin changed any variables in onBeforeSendEmail
         $variables = $event->params['variables'];
         $email = new \PHPMailer(true);
         // Default the charset to UTF-8
         $email->CharSet = 'UTF-8';
         // Add a reply to (if any).  Make sure it’s set before setting From, because email is dumb.
         if (!empty($emailModel->replyTo)) {
             $email->addReplyTo($emailModel->replyTo);
         }
         // Set the "from" information.
         $email->setFrom($emailModel->fromEmail, $emailModel->fromName);
         // Check which protocol we need to use.
         switch ($emailSettings['protocol']) {
             case EmailerType::Gmail:
             case EmailerType::Smtp:
                 $this->_setSmtpSettings($email, $emailSettings);
                 break;
             case EmailerType::Pop:
                 $pop = new \POP3();
                 if (!isset($emailSettings['host']) || !isset($emailSettings['port']) || !isset($emailSettings['username']) || !isset($emailSettings['password']) || StringHelper::isNullOrEmpty($emailSettings['host']) || StringHelper::isNullOrEmpty($emailSettings['port']) || StringHelper::isNullOrEmpty($emailSettings['username']) || StringHelper::isNullOrEmpty($emailSettings['password'])) {
                     throw new Exception(Craft::t('Host, port, username and password must be configured under your email settings.'));
                 }
                 if (!isset($emailSettings['timeout'])) {
                     $emailSettings['timeout'] = $this->_defaultEmailTimeout;
                 }
                 $pop->authorize($emailSettings['host'], $emailSettings['port'], $emailSettings['timeout'], $emailSettings['username'], $emailSettings['password'], craft()->config->get('devMode') ? 1 : 0);
                 $this->_setSmtpSettings($email, $emailSettings);
                 break;
             case EmailerType::Sendmail:
                 $email->isSendmail();
                 break;
             case EmailerType::Php:
                 $email->isMail();
                 break;
             default:
                 $email->isMail();
         }
         if (!$this->_processTestToEmail($email, 'Address')) {
             $email->addAddress($user->email, $user->getFullName());
         }
         // Add any custom headers
         if (!empty($emailModel->customHeaders)) {
             foreach ($emailModel->customHeaders as $headerName => $headerValue) {
                 $email->addCustomHeader($headerName, $headerValue);
             }
         }
         // Add any BCC's
         if (!empty($emailModel->bcc)) {
             if (!$this->_processTestToEmail($email, 'BCC')) {
                 foreach ($emailModel->bcc as $bcc) {
                     if (!empty($bcc['email'])) {
                         $bccEmail = $bcc['email'];
                         $bccName = !empty($bcc['name']) ? $bcc['name'] : '';
                         $email->addBCC($bccEmail, $bccName);
                     }
                 }
             }
         }
         // Add any CC's
         if (!empty($emailModel->cc)) {
             if (!$this->_processTestToEmail($email, 'CC')) {
                 foreach ($emailModel->cc as $cc) {
                     if (!empty($cc['email'])) {
                         $ccEmail = $cc['email'];
                         $ccName = !empty($cc['name']) ? $cc['name'] : '';
                         $email->addCC($ccEmail, $ccName);
                     }
                 }
             }
         }
         // Add a sender header (if any)
         if (!empty($emailModel->sender)) {
             $email->Sender = $emailModel->sender;
         }
         // Add any string attachments
         if (!empty($emailModel->stringAttachments)) {
             foreach ($emailModel->stringAttachments as $stringAttachment) {
                 $email->addStringAttachment($stringAttachment['string'], $stringAttachment['fileName'], $stringAttachment['encoding'], $stringAttachment['type']);
             }
         }
//.........这里部分代码省略.........
开发者ID:reedmaniac,项目名称:reedmaniac,代码行数:101,代码来源:EmailService.php

示例12: mail_fetch_login

function mail_fetch_login()
{
    require_once SM_PATH . 'include/validate.php';
    include_once SM_PATH . 'functions/imap.php';
    require_once SM_PATH . 'plugins/mail_fetch/class.POP3.php';
    require_once SM_PATH . 'plugins/mail_fetch/functions.php';
    global $data_dir, $imapServerAddress, $imapPort;
    sqgetGlobalVar('username', $username, SQ_SESSION);
    sqgetGlobalVar('key', $key, SQ_COOKIE);
    $mailfetch_newlog = getPref($data_dir, $username, 'mailfetch_newlog');
    $outMsg = '';
    $mailfetch_server_number = getPref($data_dir, $username, 'mailfetch_server_number');
    if (!isset($mailfetch_server_number)) {
        $mailfetch_server_number = 0;
    }
    $mailfetch_cypher = getPref($data_dir, $username, 'mailfetch_cypher');
    if ($mailfetch_server_number < 1) {
        $mailfetch_server_number = 0;
    }
    for ($i_loop = 0; $i_loop < $mailfetch_server_number; $i_loop++) {
        $mailfetch_login_[$i_loop] = getPref($data_dir, $username, "mailfetch_login_{$i_loop}");
        $mailfetch_fref_[$i_loop] = getPref($data_dir, $username, "mailfetch_fref_{$i_loop}");
        $mailfetch_pass_[$i_loop] = getPref($data_dir, $username, "mailfetch_pass_{$i_loop}");
        if ($mailfetch_cypher == 'on') {
            $mailfetch_pass_[$i_loop] = decrypt($mailfetch_pass_[$i_loop]);
        }
        if ($mailfetch_pass_[$i_loop] != '' && ($mailfetch_login_[$i_loop] == 'on' && $mailfetch_newlog == 'on' || $mailfetch_fref_[$i_loop] == 'on')) {
            $mailfetch_server_[$i_loop] = getPref($data_dir, $username, "mailfetch_server_{$i_loop}");
            $mailfetch_port_[$i_loop] = getPref($data_dir, $username, "mailfetch_port_{$i_loop}");
            $mailfetch_alias_[$i_loop] = getPref($data_dir, $username, "mailfetch_alias_{$i_loop}");
            $mailfetch_user_[$i_loop] = getPref($data_dir, $username, "mailfetch_user_{$i_loop}");
            $mailfetch_lmos_[$i_loop] = getPref($data_dir, $username, "mailfetch_lmos_{$i_loop}");
            $mailfetch_uidl_[$i_loop] = getPref($data_dir, $username, "mailfetch_uidl_{$i_loop}");
            $mailfetch_subfolder_[$i_loop] = getPref($data_dir, $username, "mailfetch_subfolder_{$i_loop}");
            $mailfetch_server = $mailfetch_server_[$i_loop];
            $mailfetch_port = $mailfetch_port_[$i_loop];
            $mailfetch_user = $mailfetch_user_[$i_loop];
            $mailfetch_alias = $mailfetch_alias_[$i_loop];
            $mailfetch_pass = $mailfetch_pass_[$i_loop];
            $mailfetch_lmos = $mailfetch_lmos_[$i_loop];
            $mailfetch_login = $mailfetch_login_[$i_loop];
            $mailfetch_uidl = $mailfetch_uidl_[$i_loop];
            $mailfetch_subfolder = $mailfetch_subfolder_[$i_loop];
            // $outMsg .= "$mailfetch_alias checked<br>";
            // $outMsg .= "$mailfetch_alias_[$i_loop]<br>";
            $pop3 = new POP3($mailfetch_server, 60);
            if (!$pop3->connect($mailfetch_server, $mailfetch_port)) {
                $outMsg .= _("Warning, ") . $pop3->ERROR;
                continue;
            }
            $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 10);
            $Count = $pop3->login($mailfetch_user, $mailfetch_pass);
            if (($Count == false || $Count == -1) && $pop3->ERROR != '') {
                $outMsg .= _("Login Failed:") . $pop3->ERROR;
                continue;
            }
            //   register_shutdown_function($pop3->quit());
            $msglist = $pop3->uidl();
            $i = 1;
            for ($j = 1; $j < sizeof($msglist); $j++) {
                if ($msglist["{$j}"] == $mailfetch_uidl) {
                    $i = $j + 1;
                    break;
                }
            }
            if ($Count < $i) {
                $pop3->quit();
                continue;
            }
            if ($Count == 0) {
                $pop3->quit();
                continue;
            } else {
                $newmsgcount = $Count - $i + 1;
            }
            // Faster to get them all at once
            $mailfetch_uidl = $pop3->uidl();
            if (!is_array($mailfetch_uidl) && $mailfetch_lmos == 'on') {
                $outMsg .= _("Server does not support UIDL.");
            }
            for (; $i <= $Count; $i++) {
                if (!ini_get('safe_mode')) {
                    set_time_limit(20);
                }
                // 20 seconds per message max
                $Message = "";
                $MessArray = $pop3->get($i);
                if (!$MessArray or gettype($MessArray) != "array") {
                    $outMsg .= _("Warning, ") . $pop3->ERROR;
                    continue 2;
                }
                while (list($lineNum, $line) = each($MessArray)) {
                    $Message .= $line;
                }
                /**
                 * check if mail folder is not null and subscribed
                 * Function can check if mail folder is only unsubscribed 
                 * and use unsubscribed mail folder.
                 */
                if ($mailfetch_subfolder == '' || !mail_fetch_check_folder($imap_stream, $mailfetch_subfolder)) {
//.........这里部分代码省略.........
开发者ID:jprice,项目名称:EHCP,代码行数:101,代码来源:setup.php

示例13: checkBounced

 public function checkBounced()
 {
     if ($this->config->get('ne_bounce') && $this->config->get('ne_bounce_email') && $this->config->get('ne_bounce_pop3_server') && $this->config->get('ne_bounce_pop3_user') && $this->config->get('ne_bounce_pop3_password')) {
         require_once DIR_SYSTEM . 'library/pop3_ne.php';
         $pop3 = new POP3();
         if (!@$pop3->connect($this->config->get('ne_bounce_pop3_server'), $this->config->get('ne_bounce_pop3_port') ? $this->config->get('ne_bounce_pop3_port') : 110) || !$pop3->user($this->config->get('ne_bounce_pop3_user'))) {
             return false;
         }
         $count = @$pop3->pass($this->config->get('ne_bounce_pop3_password'));
         if (false === $count) {
             return false;
         }
         if (0 === $count) {
             $pop3->quit();
             return false;
         }
         for ($i = 1; $i <= $count; $i++) {
             $message = $pop3->get($i);
             foreach ($message as $line) {
                 if (preg_match('/X-NEMail: /i', $line)) {
                     $hash = trim(str_replace('X-NEMail: ', '', $line));
                 }
             }
             if (isset($hash) && $hash) {
                 $hash = base64_decode(urldecode($hash));
                 $test = explode('|', $hash);
                 if (count($test) == 2) {
                     $data = array('uid' => $test[1], 'email' => $test[0]);
                     $query = $this->db->query("UPDATE `" . DB_PREFIX . "ne_stats_personal` SET bounced = '1' WHERE stats_personal_id = '" . (int) $data['uid'] . "' AND email = '" . $this->db->escape($data['email']) . "'");
                     if ($query) {
                         $pop3->delete($i);
                     } else {
                         $pop3->reset();
                     }
                 }
             } else {
                 if ($this->config->get('ne_bounce_delete')) {
                     $pop3->delete($i);
                 }
             }
         }
         $pop3->quit();
     }
 }
开发者ID:bgabor,项目名称:RenaniaOpencart,代码行数:44,代码来源:newsletter.php

示例14: define

// php errors
define('DISPLAY_XPM4_ERRORS', true);
// display XPM4 errors
// path to 'POP3.php' and 'SMTP.php' files from XPM4 package
require_once '../POP3.php';
require_once '../SMTP.php';
$f = 'username@hostname.net';
// from mail address / account username
$t = 'client@destination.net';
// to mail address
$p = 'password';
// account password
// standard mail message RFC2822
$m = 'From: ' . $f . "\r\n" . 'To: ' . $t . "\r\n" . 'Subject: test' . "\r\n" . 'Content-Type: text/plain' . "\r\n\r\n" . 'Text message.';
// connect to 'pop3.hostname.net' POP3 server address with authentication username '$f' and password '$p'
$p = POP3::Connect('pop3.hostname.net', $f, $p) or die(print_r($_RESULT));
// connect to 'smtp.hostname.net' SMTP server address
$c = SMTP::Connect('smtp.hostname.net') or die(print_r($_RESULT));
// send mail
$s = SMTP::Send($c, array($t), $m, $f);
// print result
if ($s) {
    echo 'Sent !';
} else {
    print_r($_RESULT);
}
// disconnect from SMTP server
SMTP::Disconnect($c);
// disconnect from POP3 server
POP3::Disconnect($p);
开发者ID:jasarjasu786,项目名称:duitasuo,代码行数:30,代码来源:pop3-smtp.php

示例15: postie_test_config

function postie_test_config()
{
    $config = config_Read();
    extract($config);
    get_currentuserinfo();
    if (!current_user_can('manage_options')) {
        LogInfo("non-admin tried to set options");
        echo "<h2> Sorry only admin can run this file</h2>";
        exit;
    }
    ?>
    <div class="wrap">
        <h1>Postie Configuration Test</h1>
        <?php 
    postie_environment();
    ?>

        <h2>Clock Tests</h2>
        <p>This shows what time it would be if you posted right now</p>
        <?php 
    $content = "";
    $data = filter_Delay($content, null, $config['time_offset']);
    EchoInfo("Post time: {$data['0']}");
    ?>

        <h2>Connect to Mail Host</h2>

        <?php 
    if (!$mail_server || !$mail_server_port || !$mail_userid) {
        EchoInfo("FAIL - server settings not complete");
    } else {
        DebugEcho("checking");
    }
    switch (strtolower($config["input_protocol"])) {
        case 'imap':
        case 'imap-ssl':
        case 'pop3-ssl':
            if (!HasIMAPSupport()) {
                EchoInfo("Sorry - you do not have IMAP php module installed - it is required for this mail setting.");
            } else {
                require_once "postieIMAP.php";
                $mail_server =& PostieIMAP::Factory($config["input_protocol"]);
                if ($email_tls) {
                    $mail_server->TLSOn();
                }
                if (!$mail_server->connect($config["mail_server"], $config["mail_server_port"], $config["mail_userid"], $config["mail_password"])) {
                    EchoInfo("Unable to connect. The server said:");
                    EchoInfo($mail_server->error());
                } else {
                    EchoInfo("Successful " . strtoupper($config['input_protocol']) . " connection on port {$config["mail_server_port"]}");
                    EchoInfo("# of waiting messages: " . $mail_server->getNumberOfMessages());
                    $mail_server->disconnect();
                }
            }
            break;
        case 'pop3':
        default:
            require_once ABSPATH . WPINC . DIRECTORY_SEPARATOR . 'class-pop3.php';
            $pop3 = new POP3();
            if (defined('POSTIE_DEBUG')) {
                $pop3->DEBUG = POSTIE_DEBUG;
            }
            if (!$pop3->connect($config["mail_server"], $config["mail_server_port"])) {
                EchoInfo("Unable to connect. The server said:" . $pop3->ERROR);
            } else {
                EchoInfo("Sucessful " . strtoupper($config['input_protocol']) . " connection on port {$config["mail_server_port"]}");
                $msgs = $pop3->login($config["mail_userid"], $config["mail_password"]);
                if ($msgs === false) {
                    //workaround for bug reported here Apr 12, 2013
                    //https://sourceforge.net/tracker/?func=detail&atid=100311&aid=3610701&group_id=311
                    //originally repoted here:
                    //https://core.trac.wordpress.org/ticket/10587
                    if (empty($pop3->ERROR)) {
                        EchoInfo("No waiting messages");
                    } else {
                        EchoInfo("Unable to login. The server said:" . $pop3->ERROR);
                    }
                } else {
                    EchoInfo("# of waiting messages: {$msgs}");
                }
                $pop3->quit();
            }
            break;
    }
    ?>
    </div>
    <?php 
}
开发者ID:arnaudjuracek,项目名称:lopendoc,代码行数:88,代码来源:postie-functions.php


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