/** * @param Array $messageIndexSet * @param bool $indexAsUid * @param Folder $folder * @return WebMailMessageCollection */ function LoadMessages(&$messageIndexSet, $indexAsUid, &$folder, $imapUids = null, $imapUidFlags = null, $imapUidSizes = null) { $messageCollection = null; if ($this->_imapMail->open_mailbox($folder->FullName, false)) { $_imapUids = array(); $_imapUidFlags = array(); $_imapUidSizes = array(); if ($imapUids == null) { //Get uid, flags and size from imap Server $paramsMessages = $this->_imapMail->getParamsMessages(); if (!is_array($paramsMessages)) { return $messageCollection; } foreach ($paramsMessages as $key => $value) { $_imapUids[$key] = $value["uid"]; $_imapUidFlags[$value["uid"]] = $value["flag"]; $_imapUidSizes[$value["uid"]] = $value["size"]; } } $messageCollection = new WebMailMessageCollection(); foreach ($messageIndexSet as $idx) { $response = $this->_imapMail->get_message($idx, $indexAsUid); if ($response) { $msg = new WebMailMessage(); $msg->LoadMessageFromRawBody($response, true); if ($indexAsUid) { $msg->Uid = $idx; } else { if ($imapUids == null) { $imapUids = $_imapUids; } $msg->Uid = $imapUids[$idx]; } if ($imapUidSizes == null) { $imapUidSizes = $_imapUidSizes; } $msg->Size = $imapUidSizes[$msg->Uid]; if ($imapUidFlags == null) { $imapUidFlags = $_imapUidSizes; } $this->_setMessageFlags($msg, $imapUidFlags[$idx]); $messageCollection->Add($msg); unset($msg); } } if ($messageCollection->Count() > 0) { return $messageCollection; } } return $messageCollection; }
/** * @access private * @param Array $messageIndexSet * @param bool $indexAsUid * @param Folder $folder * @return WebMailMessageCollection */ function _loadMessages($messageIndexSet, &$imapUids) { $messageCollection =& new WebMailMessageCollection(); $imapFlags =& $this->_imapMail->get_flaglist(); foreach ($messageIndexSet as $idx) { $response = $this->_imapMail->get_message($idx); if ($response) { $msg =& new WebMailMessage(); $msg->LoadMessageFromRawBody($response); $msg->Uid = $imapUids[$idx]; $msg->Size = strlen($response); $this->_setMessageFlags($msg, $imapFlags[$idx]); $messageCollection->Add($msg); } } if ($messageCollection->Count() > 0) { return $messageCollection; } return null; }
<?php include_once "imap.inc.php"; include_once "mimedecode.inc.php"; $imap = new IMAPMAIL(); if (!$imap->open("192.168.0.26", "143")) { echo $imap->get_error(); exit; } $imap->login("harishc", "hchauhan"); echo $imap->error; $response = $imap->open_mailbox("INBOX"); echo $imap->error; //echo $response=$imap->get_msglist(); //echo $response=$imap->delete_message(9); //echo $response=$imap->rollback_delete(9); $response = $imap->get_message(1); ///Decoding the mail $mimedecoder = new MIMEDECODE($response, "\r\n"); $msg = $mimedecoder->get_parsed_message(); print_r($msg); //echo nl2br($response); echo $imap->get_error(); $imap->close(); //$response=$imap->fetch_mail("3","BODYSTRUCTURE"); //print_r($response); //echo nl2br($response); //echo $imap->error; echo "<br>";
require_once("./config/main.inc.php"); require_once("./program/lib/imap.inc.php"); require_once("./program/lib/mimedecode.inc.php"); $imap = new IMAPMAIL; $imap->open($bloggy_config['imap_host'], $bloggy_config['imap_port']); $imap->login($bloggy_config['imap_user'],$bloggy_config['imap_pass']); $imap->open_mailbox($bloggy_config['imap_folder']); if($imap->get_msglist() > 0) { $mimedecoder=new MIMEDECODE($imap->get_message(1),"\r\n"); $data = parse($mimedecoder->get_parsed_message()->parts['0']->body, true); if($data['password'] == $bloggy_config['mail_pass']) { //If the passwords match, lets continue! $data['password'] = null; $data = array_filter($data); $post = ""; foreach($data as $key => $value) { $post .= $key.": ".$value."\r\n"; }
if (!$imap->open("mail.etelegate.com", "143")) { $log .= $imap->get_error(); print $log; exit; } $imap->login("ReturnedEmails+etelegate.com", "etelcs88"); $log .= $imap->error; $response = $imap->open_mailbox("INBOX"); $log .= $imap->error; $emailList = $imap->search_mailbox("SINCE " . date("d-M-Y", time() - 48 * 60 * 60) . " OR OR SUBJECT \"delayed 48 hours\" SUBJECT \"Undeliverable: Welcome to Gkard\" SUBJECT \"Mail delivery failed\""); //echo $response=$imap->delete_message(9); //echo $response=$imap->rollback_delete(9); if (is_array($emailList)) { foreach ($emailList as $emailId) { $log .= " Checking Email #{$emailId}...\n"; $content = $imap->get_message($emailId); //explode("",$content); //print_r($content); $matches = NULL; preg_match_all("/([A-Z0-9._-]+@[A-Z0-9.-]+\\.[A-Z]{2,6})/i", $content, &$matches); //print_r(array_unique($matches[1])); $foundEmails = $matches[1]; $email = NULL; if ($foundEmails[2] == '*****@*****.**') { $email = $foundEmails[5]; } if ($foundEmails[3] == '*****@*****.**') { $email = $foundEmails[2]; } if ($foundEmails[0] == '*****@*****.**' && $foundEmails[3] == '*****@*****.**') { $email = $foundEmails[5];