/** * Helper function to _getXML(). Returns xml of a header. * * @param string $ Name of header * @param string $ Value of header * @param integer $ Number of tabs to indent * @return string XML version of input * @access private */ function _getXML_helper($hdr_name, $hdr_value, $indent) { $htab = "\t"; $crlf = "\r\n"; $return = ''; $new_hdr_value = $hdr_name != 'received' ? MIMEDECODE::_parseHeaderValue($hdr_value) : array('value' => $hdr_value); $new_hdr_name = str_replace(' ', '-', ucwords(str_replace('-', ' ', $hdr_name))); // Sort out any parameters if (!empty($new_hdr_value['other'])) { foreach ($new_hdr_value['other'] as $paramname => $paramvalue) { $params[] = str_repeat($htab, $indent) . $htab . '<parameter>' . $crlf . str_repeat($htab, $indent) . $htab . $htab . '<paramname>' . htmlspecialchars($paramname) . '</paramname>' . $crlf . str_repeat($htab, $indent) . $htab . $htab . '<paramvalue>' . htmlspecialchars($paramvalue) . '</paramvalue>' . $crlf . str_repeat($htab, $indent) . $htab . '</parameter>' . $crlf; } $params = implode('', $params); } else { $params = ''; } $return = str_repeat($htab, $indent) . '<header>' . $crlf . str_repeat($htab, $indent) . $htab . '<headername>' . htmlspecialchars($new_hdr_name) . '</headername>' . $crlf . str_repeat($htab, $indent) . $htab . '<headervalue>' . htmlspecialchars($new_hdr_value['value']) . '</headervalue>' . $crlf . $params . str_repeat($htab, $indent) . '</header>' . $crlf; return $return; }
<?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>";
$fd = fopen("$dotreal/attachments/latest.txt", "r"); $email = ""; while (!feof($fd)) { $email .= fread($fd, 1024); } fclose($fd); */ //calling get_parsed_message of the mimedecode object //will return text part of the message, which also fills //attachment,header arrays of the mimedecode object // will get the message body with html tags if any at $var_message_main, // _mailheader attribute of mimedecoder will contain the header of the message // _header attribute of mimedecoder will contain the header as a string // _attachments attribute will contain all the attachments //echo "\n CONTENT DISPLAY"; $mimedecoder = new MIMEDECODE($email, "\r\n"); $var_message_main = $mimedecoder->get_parsed_message(); /*$myFile = "/temp/testing.txt"; chmod($myFile,0777 ); $fh = fopen($myFile, 'w+') or die("can't open file"); fwrite($fh, $var_message_main ); fclose($fh);*/ //included to remove htmlcharacters,and other characters /* $search = array ('@<script[^>]*?>.*?</script>@si', // Strip out javascript '@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags '@([\r\n])[\s]+@', // Strip out white space '@&(quot|#34);@i', // Replace HTML entities '@&(amp|#38);@i', '@&(lt|#60);@i', '@&(gt|#62);@i',
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"; }