FudBOX.php

From FUDforum Wiki
Jump to: navigation, search

FudBOX.php is a helper script, originally written by Mike Hillyer, that can be used to pipe an entire mbox with multiple E-mail messages into a forum. The code is released under the GPL v2 or higher license.

Prerequisites

The following prerequisites must be met before using this script:

Code

File fudbox.php:

 #!/usr/bin/php -q
 <?php
        define('MBOX_FILE', '/path/to/somearchive.mbox');    // The MBOX file you wish to load
        define('SCRIPT_LOCATION', '/path/to/FUDdata/scripts/maillist.php');
        define('MBOXPHP_LOCATION', '/usr/local/php/lib/php/Mail/Mbox.php');    // Path to the MBOX PEAR Module
        define('RULE_NUM', 1);    // Rule number assigned in the Mailing List Manager

        // DO NOT MAKE CHANGES BELOW THIS LINE!!!
 
        require_once(MBOXPHP_LOCATION);
        $mbox = new Mail_Mbox(MBOX_FILE);
        $mbox->open();
        for ($i = 0; $i < $mbox->size(); $i++) {
                $thisMessage = $mbox->get($i);
                echo "Loading message $i...\n";
                pipe_email($thisMessage, RULE_NUM);
                // $mbox->remove($i);        // DELETE MESSAGE FROM MBOX!
        }
        $mbox->close();
        exit();
 
        function pipe_email($message, $ruleNum)
        {
                if(!$PIPE = popen(SCRIPT_LOCATION . ' ' . $ruleNum, 'w')) {
                        exit('ERROR: Unable to open pipe to '.SCRIPT_LOCATION);
                }
                if (!fwrite($PIPE, $message)) {
                        pclose($PIPE);
                        exit('ERROR: Unable to write to pipe.');
                }
                pclose($PIPE);
                return true;
        }
 ?>

Also see

  • Mailing List Manager, admin control panel that allows the administrator to define mailing list rules.
Languages
Personal tools
This is a cached copy of the requested page, and may not be up to date.

Sorry! This site is experiencing technical difficulties.
Try waiting a few minutes and reloading.

(Can't contact the database server: Cannot return last error, no db connection)


You can try searching via Google in the meantime.
Note that their indexes of our content may be out of date.