Ejemplo n.º 1
0
 /**
  * Run this task
  *
  * @return	@e void
  */
 public function runTask()
 {
     //--------------------------------------
     // Init
     //--------------------------------------
     require_once IPS_KERNEL_PATH . '/pop3class/pop3.php';
     /*noLibHook*/
     $this->pop3 = new pop3_class();
     $this->pop3->hostname = $this->settings['pop3_server'];
     $this->pop3->port = $this->settings['pop3_port'];
     $this->pop3->tls = $this->settings['pop3_tls'];
     $this->pop3->realm = '';
     $this->pop3->workstation = '';
     $this->pop3->authentication_mechanism = 'USER';
     $this->pop3->debug = FALSE;
     $this->pop3->html_debug = FALSE;
     $this->pop3->join_continuation_header_lines = FALSE;
     $user = $this->settings['pop3_user'];
     $password = $this->settings['pop3_password'];
     $apop = FALSE;
     //--------------------------------------
     // Connect and login
     //--------------------------------------
     $open = $this->pop3->Open();
     if ($open != '') {
         return;
     }
     $login = $this->pop3->Login($user, $password, $apop);
     if ($login != '') {
         return;
     }
     //--------------------------------------
     // Any messages?
     //--------------------------------------
     $messages = NULL;
     $size = NULL;
     $this->pop3->Statistics($messages, $size);
     if (!$messages) {
         $this->pop3->Close();
         /* Log to log table - modify but dont delete */
         $this->class->appendTaskLog($this->task, $this->lang->words['task_pop3email']);
         /* Unlock Task: DO NOT MODIFY! */
         $this->class->unlockTask($this->task);
         return;
     }
     //--------------------------------------
     // Well get them then!
     //--------------------------------------
     require_once IPS_ROOT_PATH . 'sources/classes/incomingEmail/incomingEmail.php';
     $result = $this->pop3->ListMessages('', TRUE);
     if (is_array($result) and !empty($result)) {
         foreach ($result as $id => $messageID) {
             $headers = NULL;
             $body = NULL;
             $getMessage = $this->RetrieveMessage($id);
             if ($getMessage === NULL) {
                 continue;
             }
             incomingEmail::parse($getMessage);
             // And delete
             $this->pop3->DeleteMessage($id);
         }
     }
     //--------------------------------------
     // Log off
     //--------------------------------------
     $this->pop3->Close();
     /* Log to log table - modify but dont delete */
     $this->class->appendTaskLog($this->task, $this->lang->words['task_pop3email']);
     /* Unlock Task: DO NOT MODIFY! */
     $this->class->unlockTask($this->task);
 }
Ejemplo n.º 2
0
 */
$writeDebug = FALSE;
$readDebug = FALSE;
//--------------------------------------
// Init
//--------------------------------------
define('IPS_ENFORCE_ACCESS', TRUE);
define('IPB_THIS_SCRIPT', 'public');
require_once str_replace('interface/email/piping.php', '', isset($_SERVER['argv'][0]) ? $_SERVER['argv'][0] : $_SERVER['SCRIPT_FILENAME']) . 'initdata.php';
/*noLibHook*/
require_once IPS_ROOT_PATH . 'sources/base/ipsRegistry.php';
/*noLibHook*/
require_once IPS_ROOT_PATH . 'sources/base/ipsController.php';
/*noLibHook*/
$registry = ipsRegistry::instance();
$registry->init();
//-----------------------------------------
// Get the Email
//-----------------------------------------
$debugPath = DOC_IPS_ROOT_PATH . 'cache/_email.txt';
$email = file_get_contents($readDebug ? $debugPath : 'php://stdin');
if ($writeDebug) {
    file_put_contents($debugPath, $email);
}
$override = array();
if (isset($_SERVER['argv'][1])) {
    $override['to'] = $_SERVER['argv'][1];
}
require_once IPS_ROOT_PATH . 'sources/classes/incomingEmail/incomingEmail.php';
incomingEmail::parse($email, $override);
exit;