Пример #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
    }
}
Пример #2
0
 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;
         }
     }
     $message = '';
     $mimeDecodedEmail = DecodeMimeMail($email, true);
     $from = RemoveExtraCharactersInEmailAddress(trim($mimeDecodedEmail->headers["from"]));
     /*
     if ($from != "") {
         continue;
     }
     */
     //Check poster to see if a valid person
     $poster = ValidatePoster($mimeDecodedEmail, $config);
     if (!empty($poster)) {
         if ($config['TEST_EMAIL']) {
             DebugEmailOutput($email, $mimeDecodedEmail);
         }
         PostEmail($poster, $mimeDecodedEmail, $config);
     } else {
         print "<p>Ignoring email - not authorized.\n";
Пример #3
0
}
/* 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
    $poster = ValidatePoster($mimeDecodedEmail);
    if (!empty($poster)) {
        DebugEmailOutput($email, $mimeDecodedEmail);
        PostEmail($poster, $mimeDecodedEmail);
    } else {
        print "<p>Ignoring email - not authorized.\n";
    }
}