Ejemplo n.º 1
0
function fetch_mails()
{
    global $wpdb;
    /* checks mail from various mailboxes and posts those e-mails */
    //Load up some usefull libraries
    //Retreive emails
    $fetch_query = 'SELECT * FROM ' . $wpdb->prefix . 'postie_addresses';
    $mailboxes = $wpdb->get_results($fetch_query);
    print_r($mailboxes);
    $config = get_config();
    foreach ($mailboxes as $mailbox) {
        $emails = FetchMail($mailbox->server, $mailbox->port, $mailbox->email, $mailbox->passwd, $mailbox->protocol);
        //loop through messages
        foreach ($emails as $email) {
            //sanity check to see if there is any info in the message
            if ($email == NULL) {
                print 'Dang, message is empty!';
                continue;
            }
            $mimeDecodedEmail = DecodeMimeMail($email);
            $from = RemoveExtraCharactersInEmailAddress(trim($mimeDecodedEmail->headers["from"]));
            //Check poster to see if a valid person
            $poster = ValidatePoster($mimeDecodedEmail, $config);
            if (!empty($poster)) {
                if ($config['TEST_EMAIL']) {
                    DebugEmailOutput($email, $mimeDecodedEmail);
                }
                if ($mailbox->category) {
                    $config['DEFAULT_POST_CATEGORY'] = $mailbox->category;
                }
                PostEmail($poster, $mimeDecodedEmail, $config);
            } else {
                print "<p>Ignoring email - not authorized.\n";
            }
        }
        // end looping over messages
    }
}
Ejemplo n.º 2
0
<?php 
//Load up some usefull libraries
include_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . "wp-config.php";
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mimedecode.php';
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'postie-functions.php';
/* END OF USER VARIABLES */
//some variables
//error_reporting(2037);
//Retreive emails
print "<pre>\n";
print "This is the postie plugin\n";
print "time:" . time() . "\n";
include 'Revision';
$config = GetConfig();
//print_r($config);
$emails = FetchMail($config['MAIL_SERVER'], $config['MAIL_SERVER_PORT'], $config['MAIL_USERID'], $config['MAIL_PASSWORD'], $config['INPUT_PROTOCOL'], $config['TIME_OFFSET'], $config['TEST_EMAIL'], $config['DELETE_MAIL_AFTER_PROCESSING']);
if ($emails !== false) {
    //loop through messages
    foreach ($emails as $email) {
        if (function_exists('memory_get_usage')) {
            echo "memory at start of e-mail processing:" . memory_get_usage() . "\n";
        }
        //sanity check to see if there is any info in the message
        if ($email == NULL) {
            $message = __('Dang, message is empty!', 'postie');
            continue;
        } else {
            if ($email == 'already read') {
                $message = "\n" . __("There does not seem to be any new mail.", 'postie') . "\n";
                continue;
            }
Ejemplo n.º 3
0
function postie_get_mail()
{
    require_once plugin_dir_path(__FILE__) . 'mimedecode.php';
    if (!function_exists('file_get_html')) {
        require_once plugin_dir_path(__FILE__) . 'simple_html_dom.php';
    }
    EchoInfo("Starting mail fetch");
    postie_environment();
    $wp_content_path = dirname(dirname(dirname(__FILE__)));
    DebugEcho("wp_content_path: {$wp_content_path}");
    if (file_exists($wp_content_path . DIRECTORY_SEPARATOR . "filterPostie.php")) {
        DebugEcho("found filterPostie.php in {$wp_content_path}");
        include_once $wp_content_path . DIRECTORY_SEPARATOR . "filterPostie.php";
    }
    if (has_filter('postie_post')) {
        echo "Postie: filter 'postie_post' is depricated in favor of 'postie_post_before'";
    }
    $test_email = null;
    $config = config_Read();
    //extract($config);
    if (!array_key_exists('maxemails', $config)) {
        $config['maxemails'] = 0;
    }
    $emails = FetchMail($config['mail_server'], $config['mail_server_port'], $config['mail_userid'], $config['mail_password'], $config['input_protocol'], $config['time_offset'], $test_email, $config['delete_mail_after_processing'], $config['maxemails'], $config['email_tls']);
    $message = 'Done.';
    EchoInfo(sprintf(__("There are %d messages to process", "postie"), count($emails)));
    if (function_exists('memory_get_usage')) {
        DebugEcho(__("memory at start of email processing:") . memory_get_usage());
    }
    DebugDump($config);
    //loop through messages
    $message_number = 0;
    foreach ($emails as $email) {
        $message_number++;
        DebugEcho("{$message_number}: ------------------------------------");
        //sanity check to see if there is any info in the message
        if ($email == NULL) {
            $message = __('Dang, message is empty!', 'postie');
            EchoInfo("{$message_number}: {$message}");
            continue;
        } else {
            if ($email == 'already read') {
                $message = __("Message is already marked 'read'.", 'postie');
                EchoInfo("{$message_number}: {$message}");
                continue;
            }
        }
        $mimeDecodedEmail = DecodeMIMEMail($email);
        DebugEmailOutput($email, $mimeDecodedEmail);
        //Check poster to see if a valid person
        $poster = ValidatePoster($mimeDecodedEmail, $config);
        if (!empty($poster)) {
            PostEmail($poster, $mimeDecodedEmail, $config);
        } else {
            EchoInfo("Ignoring email - not authorized.");
        }
        flush();
    }
    EchoInfo("Mail fetch complete, {$message_number} emails");
    if (function_exists('memory_get_usage')) {
        DebugEcho("memory at end of email processing:" . memory_get_usage());
    }
}
Ejemplo n.º 4
0
EchoInfo("Postie Version: " . POSTIE_VERSION);
EchoInfo("Debug mode: " . (IsDebugMode() ? "On" : "Off"));
EchoInfo("Time: " . date('Y-m-d H:i:s', time()) . " GMT");
$wp_content_path = dirname(dirname(dirname(__FILE__)));
DebugEcho("wp_content_path: {$wp_content_path}");
if (file_exists($wp_content_path . DIRECTORY_SEPARATOR . "filterPostie.php")) {
    DebugEcho("found filterPostie.php in {$wp_content_path}");
    include_once $wp_content_path . DIRECTORY_SEPARATOR . "filterPostie.php";
}
$test_email = null;
$config = config_Read();
extract($config);
if (!isset($maxemails)) {
    $maxemails = 0;
}
$emails = FetchMail($mail_server, $mail_server_port, $mail_userid, $mail_password, $input_protocol, $time_offset, $test_email, $delete_mail_after_processing, $maxemails, $email_tls);
$message = 'Done.';
EchoInfo(sprintf(__("There are %d messages to process", "postie"), count($emails)));
if (function_exists('memory_get_usage')) {
    DebugEcho(__("memory at start of e-mail processing:") . memory_get_usage());
}
DebugEcho("Error log: " . ini_get('error_log'));
DebugDump($config);
//loop through messages
$message_number = 0;
foreach ($emails as $email) {
    $message_number++;
    DebugEcho("{$message_number}: ------------------------------------");
    //sanity check to see if there is any info in the message
    if ($email == NULL) {
        $message = __('Dang, message is empty!', 'postie');
Ejemplo n.º 5
0
<?php 
//Load up some usefull libraries
include_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . "wp-config.php";
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mimedecode.php';
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'postie-functions.php';
if (!TestWPVersion()) {
    print "<p>Postie Only Works For Word Press 2.0 and above.</p>";
    exit;
}
/* END OF USER VARIABLES */
//some variables
error_reporting(2037);
TestWPMailInstallation();
//Retreive emails
print "<pre>\n";
$emails = FetchMail();
//loop through messages
foreach ($emails as $email) {
    //sanity check to see if there is any info in the message
    if ($email == NULL) {
        print 'Dang, message is empty!';
        continue;
    }
    $mimeDecodedEmail = DecodeMimeMail($email);
    $from = RemoveExtraCharactersInEmailAddress(trim($mimeDecodedEmail->headers["from"]));
    /*
    if ($from != "") {
        continue;
    }
    */
    //Check poster to see if a valid person