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


PHP POP3::delete方法代码示例

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


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

示例1: array

    }
    $post_category = array(get_option('default_email_category'));
    $post_data = compact('post_content', 'post_title', 'post_date', 'post_date_gmt', 'post_author', 'post_category', 'post_status');
    $post_data = wp_slash($post_data);
    $post_ID = wp_insert_post($post_data);
    if (is_wp_error($post_ID)) {
        echo "\n" . $post_ID->get_error_message();
    }
    // We couldn't post, for whatever reason. Better move forward to the next email.
    if (empty($post_ID)) {
        continue;
    }
    /**
     * Fires after a post submitted by email is published.
     *
     * @since 1.2.0
     *
     * @param int $post_ID The post ID.
     */
    do_action('publish_phone', $post_ID);
    echo "\n<p><strong>" . __('Author:') . '</strong> ' . esc_html($post_author) . '</p>';
    echo "\n<p><strong>" . __('Posted title:') . '</strong> ' . esc_html($post_title) . '</p>';
    if (!$pop3->delete($i)) {
        echo '<p>' . sprintf(__('Oops: %s'), esc_html($pop3->ERROR)) . '</p>';
        $pop3->reset();
        exit;
    } else {
        echo '<p>' . sprintf(__('Mission complete. Message %s deleted.'), '<strong>' . $i . '</strong>') . '</p>';
    }
}
$pop3->quit();
开发者ID:gigikiri,项目名称:WordPress,代码行数:31,代码来源:wp-mail.php

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

示例3: wp_mail_receive


//.........这里部分代码省略.........
            $userdata = get_userdatabylogin($user_login);
            $user_level = $userdata->user_level;
            $post_author = $userdata->ID;
            if ($user_level > 0) {
                $post_title = xmlrpc_getposttitle($content);
                if ($post_title == '') {
                    $post_title = $subject;
                }
                echo "Subject : " . mb_conv($post_title, $blog_charset, $sub_charset) . " <br />\n";
                $post_category = get_settings('default_category');
                if (preg_match('/<category>(.+?)<\\/category>/is', $content, $matchcat)) {
                    $post_category = xmlrpc_getpostcategory($content);
                }
                if (empty($post_category)) {
                    $post_category = get_settings('default_post_category');
                }
                echo "Category : {$post_category} <br />\n";
                $post_category = explode(',', $post_category);
                if (!get_settings('emailtestonly')) {
                    // Attaching Image Files Save
                    if ($att_boundary != "") {
                        $attachment = wp_getattach($contents[2], "user-" . trim($post_author), 1);
                    }
                    if ($boundary != "" && $hatt_boundary != "") {
                        for ($i = 2; $i < count($contents); $i++) {
                            $hattachment = wp_getattach($contents[$i], "user-" . trim($post_author), 0);
                            if ($hattachment) {
                                if (preg_match("/Content-Id: \\<([^\\>]*)>/i", $contents[$i], $matches)) {
                                    $content = preg_replace("/(cid:" . preg_quote($matches[1]) . ")/", get_settings('fileupload_url') . '/' . $hattachment, $content);
                                }
                            }
                        }
                    }
                    if ($boundary != "") {
                        $content = preg_replace("/\\=[\r\n]/", "", $content);
                        $content = preg_replace("/[\r\n]/", " ", $content);
                    }
                    $content = preg_replace("|\n([^\n])|", " \$1", $content);
                    $content = preg_replace("/\\=([0-9a-fA-F]{2,2})/e", "pack('c',base_convert('\\1',16,10))", $content);
                    $content = mb_conv(trim($content), $blog_charset, $charset);
                    // If we find an attachment, add it to the post
                    if ($attachment) {
                        if (isset($img_target) && $img_target) {
                            $img_target = ' target="' . $img_target . '"';
                        } else {
                            $img_target = '';
                        }
                        if (file_exists(get_settings('fileupload_realpath') . "/thumb-" . $attachment)) {
                            $content = "<a href=\"" . get_settings('fileupload_url') . '/' . rawurlencode($attachment) . "\"" . $img_target . "><img style=\"float: left;\" hspace=\"6\" src = \"" . get_settings('fileupload_url') . '/thumb-' . rawurlencode($attachment) . "\" alt=\"" . $attachment . "\" title=\"" . $attachment . "\" /></a>" . $content . "<br clear=\"left\" />";
                        } else {
                            $content = "<a href=\"" . get_settings('fileupload_url') . '/' . rawurlencode($attachment) . "\"" . $img_target . "><img style=\"float: left;\" hspace=\"6\" src = \"" . get_settings('fileupload_url') . '/' . rawurlencode($attachment) . "\" alt=\"" . $attachment . "\" title=\"" . $attachment . "\" /></a>" . $content . "<br clear=\"left\" />";
                        }
                    }
                    $postHandler =& wp_handler('Post');
                    $postObject =& $postHandler->create();
                    $postObject->setVar('post_content', $content);
                    $postObject->setVar('post_title', trim(mb_conv($post_title, $blog_charset, $sub_charset)));
                    $postObject->setVar('post_date', $post_date);
                    $postObject->setVar('post_author', $post_author);
                    $postObject->setVar('post_category', $post_category[0]);
                    $postObject->setVar('post_name', sanitize_title($post_title));
                    if ($flat < 500) {
                        $postObject->setVar('post_lat', $flat);
                        $postObject->setVar('post_lon', $flon);
                    }
                    if (!$postHandler->insert($postObject, true)) {
                        echo "<b>Error: Insert New Post</b><br />";
                    }
                    $post_ID = $postObject->getVar('ID');
                    echo "Post ID = {$post_ID}<br />\n";
                    $postObject->assignCategories($post_category);
                    do_action('publish_post', $post_ID);
                    do_action('publish_phone', $post_ID);
                    if ($flat < 500) {
                        pingGeoUrl($post_ID);
                    }
                    $blog_ID = 1;
                    pingWeblogs($blog_ID);
                    pingBlogs($blog_ID);
                    pingback($content, $post_ID);
                }
                echo "\n<p><b>Posted title:</b> {$post_title}<br />\n";
                echo "<b>Posted content:</b><br /><pre>" . $content . "</pre></p>\n";
                if (!$wp_pop3->delete($mail_num)) {
                    echo "<p>Oops " . $wp_pop3->ERROR . "</p></div>\n";
                    $wp_pop3->reset();
                    return;
                } else {
                    echo "<p>Mission complete, message <strong>{$mail_num}</strong> deleted.</p>\n";
                }
            } else {
                echo "<p><strong>Level 0 users can\\'t post.</strong></p>\n";
            }
            echo "</div>\n";
        }
    }
    $wp_pop3->quit();
    timer_stop($output_debugging_info);
    return;
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:101,代码来源:wp-mail.php

示例4: wp_mail_receive


//.........这里部分代码省略.........
            $post_author = $result->ID;
            if ($user_level > 0) {
                $post_title = xmlrpc_getposttitle($content);
                if ($post_title == '') {
                    $post_title = $subject;
                }
                $post_category = get_settings('default_category');
                if (preg_match('/<category>(.+?)<\\/category>/is', $content, $matchcat)) {
                    $post_category = xmlrpc_getpostcategory($content);
                }
                if ($post_category == '') {
                    $post_category = get_settings('default_post_category');
                }
                if (function_exists('mb_convert_encoding')) {
                    echo "Subject : " . mb_convert_encoding($subject, $blog_charset, $sub_charset) . " <br />\n";
                } else {
                    echo "Subject : " . $subject . " <br />\n";
                }
                echo "Category : {$post_category} <br />\n";
                if (!get_settings('emailtestonly')) {
                    // Attaching Image Files Save
                    if ($att_boundary != "") {
                        $attachment = wp_getattach($contents[2], trim($user_login), 1);
                    }
                    if ($boundary != "" && $hatt_boundary != "") {
                        for ($i = 2; $i < count($contents); $i++) {
                            $hattachment = wp_getattach($contents[$i], trim($user_login), 0);
                            if ($hattachment) {
                                if (preg_match("/Content-Id: \\<([^\\>]*)>/i", $contents[$i], $matches)) {
                                    $content = preg_replace("/(cid:" . preg_quote($matches[1]) . ")/", "{$siteurl}/attach/" . $hattachment, $content);
                                }
                            }
                        }
                    }
                    if ($boundary != "") {
                        $content = preg_replace("/\\=[\r\n]/", "", $content);
                        $content = preg_replace("/[\r\n]/", " ", $content);
                    }
                    $content = preg_replace("|\n([^\n])|", " \$1", $content);
                    $content = preg_replace("/\\=([0-9a-fA-F]{2,2})/e", "pack('c',base_convert('\\1',16,10))", $content);
                    if (function_exists('mb_convert_encoding')) {
                        $content = addslashes(mb_convert_encoding(trim($content), $blog_charset, $charset));
                        $post_title = addslashes(trim(mb_convert_encoding($post_title, $blog_charset, $sub_charset)));
                    } else {
                        $content = addslashes(trim($content));
                        $post_title = addslashes(trim($post_title));
                    }
                    // If we find an attachment, add it to the post
                    if ($attachment) {
                        if (file_exists("attach/thumb-" . $attachment)) {
                            $content = "<a href=\"" . $siteurl . "/attach/" . $attachment . "\"><img style=\"float: left;\" hspace=\"6\" src = \"" . $siteurl . "/attach/thumb-" . $attachment . "\"  alt=\"moblog\" ></a>" . $content . "<br clear=left>";
                        } else {
                            $content = "<a href=\"" . $siteurl . "/attach/" . $attachment . "\"><img style=\"float: left;\" hspace=\"6\" src = \"" . $siteurl . "/attach/" . $attachment . "\"  alt=\"moblog\" ></a>" . $content . "<br clear=left>";
                        }
                    }
                    if ($flat > 500) {
                        $sql = "INSERT INTO {$wpdb->posts[$wp_id]} (post_author, post_date, post_content, post_title, post_category) VALUES ({$post_author}, '{$post_date}', '{$content}', '{$post_title}', {$post_category})";
                    } else {
                        $sql = "INSERT INTO {$wpdb->posts[$wp_id]} (post_author, post_date, post_content, post_title, post_category, post_lat, post_lon) VALUES ({$post_author}, '{$post_date}', '{$content}', '{$post_title}', {$post_category}, {$flat}, {$flon})";
                    }
                    $result = $wpdb->query($sql);
                    $post_ID = $wpdb->insert_id;
                    echo "Post ID = {$post_ID}<br />\n";
                    if (isset($sleep_after_edit) && $sleep_after_edit > 0) {
                        sleep($sleep_after_edit);
                    }
                    $blog_ID = 1;
                    if ($flat < 500) {
                        pingGeoUrl($post_ID);
                    }
                    // Double check it's not there already
                    $exists = $wpdb->get_row("SELECT * FROM {$wpdb->post2cat[$wp_id]} WHERE post_id = {$post_ID} AND category_id = {$post_category}");
                    if (!$exists && $result) {
                        $wpdb->query("\n\t\t\t\t\t\tINSERT INTO {$wpdb->post2cat[$wp_id]}\n\t\t\t\t\t\t(post_id, category_id)\n\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t({$post_ID}, {$post_category})\n\t\t\t\t\t\t");
                    }
                    pingWeblogs($blog_ID);
                    pingBlogs($blog_ID);
                    //					pingback($content, $post_ID);
                    do_action('publish_post', $post_ID);
                    do_action('publish_phone', $post_ID);
                }
                echo "\n<p><b>Posted title:</b> {$post_title}<br />\n";
                echo "<b>Posted content:</b><br /><pre>" . $content . "</pre></p>\n";
                if (!$wp_pop3->delete($iCount)) {
                    echo "<p>Oops " . $wp_pop3->ERROR . "</p></div>\n";
                    $wp_pop3->reset();
                    return;
                } else {
                    echo "<p>Mission complete, message <strong>{$iCount}</strong> deleted.</p>\n";
                }
            } else {
                echo "<p><strong>Level 0 users can\\'t post.</strong></p>\n";
            }
            echo "</div>\n";
        }
    }
    $wp_pop3->quit();
    timer_stop($output_debugging_info);
    return;
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:101,代码来源:wp-mail.php

示例5: fputs

     fputs($imap_stream, "\r\n");
     sqimap_read_data($imap_stream, "A3{$i}", false, $response, $message);
     if ($response != 'OK') {
         Mail_Fetch_Status(_("Error Appending Message!") . " " . $message);
         Mail_Fetch_Status(_("Closing POP"));
         $pop3->quit();
         Mail_Fetch_Status(_("Logging out from IMAP"));
         sqimap_logout($imap_stream);
         Mail_Fetch_Status(_("Saving UIDL"));
         setPref($data_dir, $username, "mailfetch_uidl_{$i_loop}", $mailfetch_uidl[$i - 1]);
         exit;
     } else {
         Mail_Fetch_Status(_("Message appended to mailbox"));
     }
     if ($mailfetch_lmos != 'on') {
         if ($pop3->delete($i)) {
             Mail_Fetch_Status(sprintf(_("Message %d deleted from remote server!"), $i));
         } else {
             Mail_Fetch_Status(_("Delete failed:") . htmlspecialchars($pop3->ERROR));
         }
     }
 } else {
     echo "{$Line}";
     Mail_Fetch_Status(_("Error Appending Message!"));
     Mail_Fetch_Status(_("Closing POP"));
     $pop3->quit();
     Mail_Fetch_Status(_("Logging out from IMAP"));
     sqimap_logout($imap_stream);
     // not gurantee corect!
     Mail_Fetch_Status(_("Saving UIDL"));
     setPref($data_dir, $username, "mailfetch_uidl_{$i_loop}", $mailfetch_uidl[$i - 1]);
开发者ID:jin255ff,项目名称:company_website,代码行数:31,代码来源:fetch.php

示例6: pingBlogs

         pingBlogs($blog_ID);
         pingback($content, $post_ID);
     }
     echo "\n<p><b>Posted title:</b> {$post_title}<br />";
     echo "\n<b>Posted content:</b><br /><pre>" . $content . '</pre></p>';
     if (!$post_categories) {
         $post_categories[] = 1;
     }
     foreach ($post_categories as $post_category) {
         // Double check it's not there already
         $exists = $wpdb->get_row("SELECT * FROM {$tablepost2cat} WHERE post_id = {$post_ID} AND category_id = {$post_category}");
         if (!$exists && $result) {
             $wpdb->query("\n\t\t\t\tINSERT INTO {$tablepost2cat}\n\t\t\t\t(post_id, category_id)\n\t\t\t\tVALUES\n\t\t\t\t({$post_ID}, {$post_category})\n\t\t\t\t");
         }
     }
     if (!$pop3->delete($iCount)) {
         echo '<p>Oops ' . $pop3->ERROR . '</p></div>';
         $pop3->reset();
         exit;
     } else {
         echo "<p>Mission complete, message <strong>{$iCount}</strong> deleted.</p>";
     }
 } else {
     echo '<p><strong>Level 0 users can\'t post.</strong></p>';
 }
 echo '</div>';
 if ($output_debugging_info) {
     ob_end_flush();
 } else {
     ob_end_clean();
 }
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:31,代码来源:wp-mail.php

示例7: mail_fetch_login


//.........这里部分代码省略.........
            $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)) {
                    fputs($imap_stream, "A3{$i} APPEND INBOX {" . strlen($Message) . "}\r\n");
                } else {
                    fputs($imap_stream, "A3{$i} APPEND {$mailfetch_subfolder} {" . strlen($Message) . "}\r\n");
                }
                $Line = fgets($imap_stream, 1024);
                if (substr($Line, 0, 1) == '+') {
                    fputs($imap_stream, $Message);
                    fputs($imap_stream, "\r\n");
                    sqimap_read_data($imap_stream, "A3{$i}", false, $response, $message);
                    if ($mailfetch_lmos != 'on') {
                        $pop3->delete($i);
                    }
                } else {
                    echo "{$Line}";
                    $outMsg .= _("Error Appending Message!");
                }
            }
            $pop3->quit();
            sqimap_logout($imap_stream);
            if (is_array($mailfetch_uidl)) {
                setPref($data_dir, $username, "mailfetch_uidl_{$i_loop}", array_pop($mailfetch_uidl));
            }
        }
    }
    if (trim($outMsg) != '') {
        echo '<br><font size="1">' . _("Mail Fetch Result:") . "<br>{$outMsg}</font>";
    }
    if ($mailfetch_newlog == 'on') {
        setPref($data_dir, $username, 'mailfetch_newlog', 'off');
    }
}
开发者ID:jprice,项目名称:EHCP,代码行数:101,代码来源:setup.php

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

示例9: ajax_bounce_test_check

 public function ajax_bounce_test_check()
 {
     $return['success'] = false;
     $return['msg'] = '';
     $passes = intval($_POST['passes']);
     $identifier = $_POST['identifier'];
     if (!mymail_option('bounce_active')) {
         $return['complete'] = true;
         echo json_encode($return);
         exit;
     }
     $server = mymail_option('bounce_server');
     $user = mymail_option('bounce_user');
     $pwd = mymail_option('bounce_pwd');
     if (!$server || !$user || !$pwd) {
         $return['complete'] = true;
         echo json_encode($return);
         exit;
     }
     if (mymail_option('bounce_ssl')) {
         $server = 'ssl://' . $server;
     }
     require_once ABSPATH . WPINC . '/class-pop3.php';
     $pop3 = new POP3();
     if (!$pop3->connect($server, mymail_option('bounce_port', 110)) || !$pop3->user($user)) {
         $return['complete'] = true;
         $return['msg'] = __('Unable to connect to bounce server! Please check your settings.', 'mymail');
         echo json_encode($return);
         exit;
     }
     $return['success'] = true;
     $count = $pop3->pass($pwd);
     $return['msg'] = __('checking for new messages', 'mymail') . str_repeat('.', $passes);
     if ($passes > 20) {
         $return['complete'] = true;
         $return['msg'] = __('Unable to get test message! Please check your settings.', 'mymail');
     }
     if (false === $count || 0 === $count) {
         if (0 === $count) {
             $pop3->quit();
         }
         echo json_encode($return);
         exit;
     }
     for ($i = 1; $i <= $count; $i++) {
         $message = $pop3->get($i);
         if (!$message) {
             continue;
         }
         $message = implode($message);
         if (strpos($message, $identifier)) {
             $pop3->delete($i);
             $pop3->quit();
             $return['complete'] = true;
             $return['msg'] = __('Your bounce server is good!', 'mymail');
             echo json_encode($return);
             exit;
         } else {
             $pop3->reset();
         }
     }
     $pop3->quit();
     echo json_encode($return);
     exit;
 }
开发者ID:ganastor,项目名称:LibraryBox-Custom-MediaBox-,代码行数:65,代码来源:settings.class.php

示例10: check_bounces

 private function check_bounces()
 {
     if (!mymail_option('bounce_active')) {
         return false;
     }
     do_action('mymail_check_bounces');
     $server = mymail_option('bounce_server');
     $user = mymail_option('bounce_user');
     $pwd = mymail_option('bounce_pwd');
     if (!$server || !$user || !$pwd) {
         return false;
     }
     if (get_transient('mymail_check_bounces_lock')) {
         return false;
     }
     //check bounces only every five minutes
     set_transient('mymail_check_bounces_lock', true, 360);
     if (mymail_option('bounce_ssl')) {
         $server = 'ssl://' . $server;
     }
     require_once ABSPATH . WPINC . '/class-pop3.php';
     $pop3 = new POP3();
     if (!$pop3->connect($server, mymail_option('bounce_port', 110)) || !$pop3->user($user)) {
         return false;
     }
     $count = $pop3->pass($pwd);
     if (false === $count) {
         return false;
     }
     if (0 === $count) {
         $pop3->quit();
         return false;
     }
     $delete_bounces = mymail_option('bounce_delete');
     //only max 1000 at once
     $count = min($count, 1000);
     for ($i = 1; $i <= $count; $i++) {
         $message = $pop3->get($i);
         if (!$message) {
             continue;
         }
         $message = implode($message);
         preg_match('#X-MyMail: ([a-f0-9]{32})#i', $message, $hash);
         preg_match('#X-MyMail-Campaign: (\\d+)#i', $message, $camp);
         if (!empty($hash) && !empty($camp)) {
             if ($this->reset_mail($hash[1], $camp[1])) {
                 $pop3->delete($i);
             } else {
                 $pop3->reset();
             }
         } else {
             if ($delete_bounces) {
                 $pop3->delete($i);
             }
         }
     }
     $pop3->quit();
     //do third party stuff
     $this->thirdpartystuff();
 }
开发者ID:ganastor,项目名称:LibraryBox-Custom-MediaBox-,代码行数:60,代码来源:mymail.class.php

示例11: workPopfetcher

 function workPopfetcher(&$eventData)
 {
     global $serendipity;
     static $debug = null;
     if ($debug === null) {
         $debug = $this->debug = serendipity_db_bool($this->get_config('debug'));
     }
     // updertEntry() will not function unless this is set:
     $serendipity['POST']['properties']['fake'] = 'fake';
     $_SESSION['serendipityRightPublish'] = true;
     $this->out('<h3>' . PLUGIN_MF_NAME . ' v' . POPFETCHER_VERSION . ' @ ' . date("D M j G:i:s T Y") . '</h3>');
     $debug_file = null;
     // DEVELOPERS: If set to a filename, you can bypass fetching POP and use a file instead.
     $debug_mail = $this->get_config('debug_mail');
     if (strlen($debug_mail) != '' && file_exists($debug_mail)) {
         $debug_file = $debug_mail;
     }
     if ($debug_file != null) {
         $this->debug = true;
     }
     $authorid = $this->get_config('author');
     if (empty($authorid) || $authorid == 'empty') {
         $authorid = isset($serendipity['authorid']) ? $serendipity['authorid'] : 1;
     }
     $mailserver = trim($this->get_config('mailserver'));
     $mailport = $this->get_config('mailport');
     $mailuser = trim($this->get_config('mailuser'));
     $mailpass = trim($this->get_config('mailpass'));
     $timeout = $this->get_config('timeout');
     $deleteflag = serendipity_db_bool($this->get_config('deleteflag'));
     $apopflag = serendipity_db_bool($this->get_config('apopflag'));
     $blogflag = serendipity_db_bool($this->get_config('blogflag'));
     $striptagsflag = serendipity_db_bool($this->get_config('striptagsflag'));
     $publishflag = serendipity_db_bool($this->get_config('publishflag'));
     $onlyfrom = $this->get_config('onlyfrom', '');
     $maildir = trim($this->get_config('maildir'));
     $category = trim($this->get_config('category'));
     $adflag = serendipity_db_bool($this->get_config('adflag'));
     $plaintext_is_body_flag = serendipity_db_bool($this->get_config('plaintext_is_body'));
     $plaintext_use_extended_flag = serendipity_db_bool($this->get_config('plaintext_use_extended'));
     $list_virus = array('.pif', '.vbs', '.scr', '.bat', '.com', '.exe');
     $list_imagetype = array('jpg', 'jpeg', 'gif', 'png', 'x-png', 'pjpeg');
     $list_imageext = array('.gif', '.jpg', '.png', '.jpeg');
     $list_ignore = array('.smil');
     $output = '';
     $dirpath = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $maildir;
     $dupcount = 0;
     // Upload directory must end with a slash character
     if (strrchr($dirpath, '/') != '/') {
         $output = MF_ERROR7;
         $this->out('<br />' . $output . '<br />');
         return true;
     }
     // Upload directory must be writable
     if (!is_writable($dirpath)) {
         $output = MF_ERROR6;
         $this->out('<br />' . $output . '<br />');
         return true;
     }
     if (serendipity_db_bool($this->get_config('subfolder'))) {
         $dirpath = $dirpath . '/' . date('Y');
         if (!is_dir($dirpath)) {
             mkdir($dirpath);
         }
         $dirpath = $dirpath . '/' . date('m') . '/';
         if (!is_dir($dirpath)) {
             mkdir($dirpath);
         }
         $maildir .= date('Y') . '/' . date('m') . '/';
     }
     $maildir = str_replace('//', '/', $maildir);
     // Category (if specified) must exist
     if (!empty($category)) {
         $cid = serendipity_fetchCategoryInfo(null, $category);
         if ($cid == false) {
             $output = MF_ERROR8;
             $this->out('<br />' . $output . '<br />');
             return true;
         }
     }
     if ($debug_file === null) {
         // Create new instance of POP3 connection
         $pop3 = new POP3($mailserver, $timeout);
         // Attempt to connect to mail server
         if (!$pop3->connect($mailserver, $mailport)) {
             $output = MF_ERROR1 . ': ' . $pop3->ERROR;
             $this->out('<br />' . $output . '<br />');
             return true;
         }
         // Try APOP login if requested, otherwise, regular login
         if ($apopflag) {
             $Count = $pop3->apop($mailuser, $mailpass);
         } else {
             $Count = $pop3->login($mailuser, $mailpass);
         }
         // Check for error retrieving number of msgs in mailbox
         if ($Count === false or $Count == -1) {
             $output = MF_ERROR2 . ': ' . $pop3->ERROR;
             $this->out('<br />' . $output . '<br />');
             return true;
//.........这里部分代码省略.........
开发者ID:sqall01,项目名称:additional_plugins,代码行数:101,代码来源:serendipity_event_popfetcher.php


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