Example #1
0
     $can_addAttachment = $acc['attachments'];
 }
 if (empty($acc['account'])) {
     continue;
 }
 $content .= "<b>Processing account</b><br />";
 $content .= "Account :" . $acc['account'] . "<br />";
 $content .= "Type    :" . $acc['type'] . "<br />";
 $content .= "--------------------------<br />";
 $pop3 = new Net_Pop3();
 $content .= "Connecting...";
 if ($pop3->connect($acc["pop"], $acc["port"])) {
     $content .= "OK.<br />";
     $content .= "Logging in...";
     // Login
     if ($status = $pop3->login($acc["username"], $acc["pass"], "USER") !== FALSE) {
         $content .= "OK (" . $status . ").<br />";
         if (defined($debugger)) {
             $debugger->msg("Logged in, status " . $status);
         }
     } else {
         $content .= "FAILED.<br />";
         if (defined($debugger)) {
             $debugger->msg("Login failed, status " . $status);
             $debugger->msg("dump of pop3:");
             $debugger->var_dump('$pop3');
         }
     }
     $mailsum = $pop3->numMsg();
     if ($mailsum === FALSE) {
         $content .= "No messages.<br />";
Example #2
0
// The mailin script is used to get / set wiki pages using an email account
// Get a list of ACTIVE emails accounts configured for mailin procedures
$accs = $mailinlib->list_active_mailin_accounts(0, -1, 'account_desc', '');
//print ('<a href="tiki-admin_mailin.php">Admin</a><br /><br />');
$content = '<br /><br />';
// foreach account
foreach ($accs['data'] as $acc) {
    $content .= "<b>Processing account</b><br />";
    $content .= "Account :" . $acc['account'] . "<br />";
    $content .= "Type    :" . $acc['type'] . "<br />";
    $content .= "--------------------------<br />";
    //$pop3 = new POP3($acc["pop"], $acc["username"], $acc["pass"]);
    //$pop3->Open();
    $pop3 = new Net_Pop3();
    $pop3->connect($acc["pop"]);
    $pop3->login($acc["username"], $acc["pass"]);
    $mailsum = $pop3->numMsg();
    for ($i = 1; $i <= $mailsum; $i++) {
        $aux = $pop3->getParsedHeaders($i);
        var_dump($aux);
        if (!isset($aux["From"])) {
            $aux['From'] = $aux['Return-path'];
        }
        preg_match('/<?([-!#$%&\'*+\\.\\/0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\\.[-!#$%&\'*+\\.\\/0-9=?A-Z^_`a-z{|}~]+)>?/', $aux["From"], $mail);
        $email_from = $mail[1];
        $aux["msgid"] = $i;
        $aux["realmsgid"] = ereg_replace("[<>]", "", $aux["Message-ID"]);
        $message = $pop3->getMsg($i);
        $output = mime::decode($message);
        //mailin_parse_output($output, $parts, 0);
        $content .= "Reading a request.<br />From: " . $aux["From"] . "<br />Subject: " . $output['header']['subject'] . "<br />";