public function readEmails($sentTo = null, $bodyPart = null) { $host = '{imap.gmail.com:993/imap/ssl}INBOX'; $spinner = new Spinner('Could not connect to Imap server.', 60, 10000); $inbox = $spinner->assertBecomesTrue(function () use($host) { return @imap_open($host, $this->email, $this->password); }); $emails = imap_search($inbox, 'TO ' . ($sentTo ? $sentTo : $this->email)); if ($emails) { $messages = []; foreach ($emails as $n) { $structure = imap_fetchstructure($inbox, $n); if (!$bodyPart) { $part = $this->findPart($structure, function ($part) { return $part->subtype === 'HTML'; }); } elseif (is_callable($bodyPart)) { $part = $this->findPart($structure, $bodyPart); } else { $part = $bodyPart; } $hinfo = imap_headerinfo($inbox, $n); $subject = $hinfo->subject; $message = ['subject' => $subject, 'body' => imap_fetchbody($inbox, $n, $part)]; $messages[] = $message; } return $messages; } else { return []; } }
function getAttachments($id, $path) { $parts = imap_fetchstructure($this->mailbox, $id); $attachments = array(); //FIXME if we do an is_array() here it breaks howver if we don't //we get foreach errors foreach ($parts->parts as $key => $value) { $encoding = $parts->parts[$key]->encoding; if ($parts->parts[$key]->ifdparameters) { $filename = $parts->parts[$key]->dparameters[0]->value; $message = imap_fetchbody($this->mailbox, $id, $key + 1); switch ($encoding) { case 0: $message = imap_8bit($message); case 1: $message = imap_8bit($message); case 2: $message = imap_binary($message); case 3: $message = imap_base64($message); case 4: $message = quoted_printable_decode($message); case 5: default: $message = $message; } $fp = fopen($path . $filename, "w"); fwrite($fp, $message); fclose($fp); $attachments[] = $filename; } } return $attachments; }
/** * Get messages according to a search criteria * * @param string search criteria (RFC2060, sec. 6.4.4). Set to "UNSEEN" by default * NB: Search criteria only affects IMAP mailboxes. * @param string date format. Set to "Y-m-d H:i:s" by default * @return mixed array containing messages */ public function get_messages($search_criteria = "UNSEEN", $date_format = "Y-m-d H:i:s") { $msgs = imap_search($this->imap_stream, $search_criteria); $no_of_msgs = $msgs ? count($msgs) : 0; $messages = array(); for ($i = 0; $i < $no_of_msgs; $i++) { // Get Message Unique ID in case mail box changes // in the middle of this operation $message_id = imap_uid($this->imap_stream, $msgs[$i]); $header = imap_header($this->imap_stream, $message_id); $date = date($date_format, $header->udate); $from = $header->from; $fromname = ""; $fromaddress = ""; $subject = ""; foreach ($from as $id => $object) { if (isset($object->personal)) { $fromname = $object->personal; } $fromaddress = $object->mailbox . "@" . $object->host; if ($fromname == "") { // In case from object doesn't have Name $fromname = $fromaddress; } } if (isset($header->subject)) { $subject = $this->_mime_decode($header->subject); } $structure = imap_fetchstructure($this->imap_stream, $message_id); $body = ''; if (!empty($structure->parts)) { for ($j = 0, $k = count($structure->parts); $j < $k; $j++) { $part = $structure->parts[$j]; if ($part->subtype == 'PLAIN') { $body = imap_fetchbody($this->imap_stream, $message_id, $j + 1); } } } else { $body = imap_body($this->imap_stream, $message_id); } // Convert quoted-printable strings (RFC2045) $body = imap_qprint($body); array_push($messages, array('msg_no' => $message_id, 'date' => $date, 'from' => $fromname, 'email' => $fromaddress, 'subject' => $subject, 'body' => $body)); // Mark Message As Read imap_setflag_full($this->imap_stream, $message_id, "\\Seen"); } return $messages; }
function parse_message($connection, $message_number, $option = null, $to_charset = 'UTF-8') { $result = array('messages' => array(), 'attachments' => array()); $structure = imap_fetchstructure($connection, $message_number, $option); if (isset($structure->parts)) { $flatten = parse_message_flatten($structure->parts); } else { $flatten = array(1 => $structure); } foreach ($flatten as $id => &$part) { switch ($part->type) { case TYPETEXT: $message = parse_message_decode_text($connection, $part, $message_number, $id, $option, $to_charset); $result['messages'][] = $message; break; case TYPEAPPLICATION: case TYPEAUDIO: case TYPEIMAGE: case TYPEVIDEO: case TYPEOTHER: $attachment = parse_message_decode_attach($connection, $part, $message_number, $id, $option); if ($attachment) { $result['attachments'][] = $attachment; } break; case TYPEMULTIPART: case TYPEMESSAGE: break; } } return $result; }
/** * Get messages according to a search criteria * * @param string search criteria (RFC2060, sec. 6.4.4). Set to "UNSEEN" by default NB: Search criteria only affects IMAP mailboxes. * @param string date format. Set to "Y-m-d H:i:s" by default * @return mixed array containing messages */ public function get_messages($search_criteria = "UNSEEN", $date_format = "Y-m-d H:i:s") { $msgs = imap_search($this->imap_stream, $search_criteria); $no_of_msgs = $msgs ? count($msgs) : 0; $messages = array(); for ($i = 0; $i < $no_of_msgs; $i++) { $header = imap_header($this->imap_stream, $msgs[$i]); $date = date($date_format, $header->udate); $from = $this->_mime_decode($header->fromaddress); $subject = $this->_mime_decode($header->subject); $structure = imap_fetchstructure($this->imap_stream, $msgs[$i]); if (!empty($structure->parts)) { for ($j = 0, $k = count($structure->parts); $j < $k; $j++) { $part = $structure->parts[$j]; if ($part->subtype == 'PLAIN') { $body = imap_fetchbody($this->imap_stream, $msgs[$i], $j + 1); } } } else { $body = imap_body($this->imap_stream, $msgs[$i]); } // Convert quoted-printable strings (RFC2045) $body = imap_qprint($body); array_push($messages, array('msg_no' => $msgs[$i], 'date' => $date, 'from' => $from, 'subject' => $subject, 'body' => $body)); } return $messages; }
public function fetch($delete = false) { $oImap = imap_open('{' . $this->mail_server . ':993/imap/ssl/notls/novalidate-cert}', $this->username, $this->password); $oMailboxStatus = imap_check($oImap); $aMessages = imap_fetch_overview($oImap, "1:{$oMailboxStatus->Nmsgs}"); $validMessages = array(); foreach ($aMessages as $oMessage) { print "Trying message '" . $oMessage->subject . "'"; $fileContent = $fileType = ''; $geocoder = factory::create('geocoder'); $postCode = $geocoder->extract_postcode($oMessage->subject); $fromName = null; $fromEmail = null; if (strpos($oMessage->from, '<')) { $split = split('<', $oMessage->from); //name - make sure name not an email address $fromName = trim($split[0]); if (valid_email($fromName)) { $fromName = null; } //email $fromEmail = trim(str_replace('>', '', $split[1])); } else { $fromEmail = $oMessage->from; } $images = array(); $messageStructure = imap_fetchstructure($oImap, $oMessage->msgno); if (isset($messageStructure->parts)) { $partNumber = 0; foreach ($messageStructure->parts as $oPart) { $partNumber++; if ($oPart->subtype == 'PLAIN' && !$postCode) { $messageContent = imap_fetchbody($oImap, $oMessage->msgno, $partNumber); if ($oPart->encoding == 4) { $messageContent = quoted_printable_decode($messageContent); } $postCode = geocoder::extract_postcode($messageContent); } elseif ($oPart->encoding == 3 && in_array($oPart->subtype, array('JPEG', 'PNG'))) { $oImage = null; $encodedBody = imap_fetchbody($oImap, $oMessage->msgno, $partNumber); $fileContent = base64_decode($encodedBody); $oImage = imagecreatefromstring($fileContent); if (imagesx($oImage) > $this->min_import_size && imagesy($oImage) > $this->min_import_size) { array_push($images, $oImage); } $fileType = strtolower($oPart->subtype); } } } //add to the messages array array_push($validMessages, array('postcode' => $postCode, 'images' => $images, 'file_type' => $fileType, 'from_address' => $fromAddress, 'from_email' => $fromEmail, 'from_name' => $fromName)); if ($delete) { imap_delete($oImap, $oMessage->msgno); } } imap_close($oImap, CL_EXPUNGE); $this->messages = $validMessages; }
function getdata($host, $login, $password, $savedirpath) { $mbox = imap_open($host, $login, $password) or die("can't connect: " . imap_last_error()); $message = array(); $message["attachment"]["type"][0] = "text"; $message["attachment"]["type"][1] = "multipart"; $message["attachment"]["type"][2] = "message"; $message["attachment"]["type"][3] = "application"; $message["attachment"]["type"][4] = "audio"; $message["attachment"]["type"][5] = "image"; $message["attachment"]["type"][6] = "video"; $message["attachment"]["type"][7] = "other"; $buzon_destino = "cfdi"; echo imap_createmailbox($mbox, imap_utf7_encode("{$buzon_destino}")); echo imap_num_msg($mbox); for ($jk = 1; $jk <= imap_num_msg($mbox); $jk++) { $structure = imap_fetchstructure($mbox, $jk); $parts = $structure->parts; $fpos = 2; for ($i = 1; $i < count($parts); $i++) { $message["pid"][$i] = $i; $part = $parts[$i]; if (strtolower($part->disposition) == "attachment") { $message["type"][$i] = $message["attachment"]["type"][$part->type] . "/" . strtolower($part->subtype); $message["subtype"][$i] = strtolower($part->subtype); $ext = $part->subtype; $params = $part->dparameters; $filename = $part->dparameters[0]->value; if (!($ext == 'xml' or $ext == 'XML' or $ext == 'PDF' or $ext == 'pdf')) { continue; } $mege = ""; $data = ""; $mege = imap_fetchbody($mbox, $jk, $fpos); $data = $this->getdecodevalue($mege, $part->type); $fp = fopen($filename, 'w'); fputs($fp, $data); fclose($fp); $fpos += 1; /* Se mueve el archiv descargado al directorio de recibidos */ // rename($filename, $savedirpath.$filename); // printf("\nSe movio el archivo $filename"); } } $result = imap_fetch_overview($mbox, $jk); echo $result[0]->from; // imap_mail_move($mbox, $jk, $buzon_destino); //imap_delete tags a message for deletion // imap_delete($mbox,$jk); } // imap_expunge deletes all tagged messages // imap_expunge($mbox); imap_close($mbox); }
public function readMessage($messageid) { $message = array(); $header = imap_header($this->mailbox, $messageid); $structure = imap_fetchstructure($this->mailbox, $messageid); $message['subject'] = $header->subject; $message['fromaddress'] = $header->fromaddress; $message['toaddress'] = $header->toaddress; //$message['ccaddress'] = $header->ccaddress; $message['date'] = $header->date; $message['id'] = $messageid; if ($this->check_type($structure)) { $message['body'] = imap_fetchbody($this->mailbox, $messageid, "2"); ## GET THE BODY OF MULTI-PART MESSAGE if (!$message['body']) { $message['body'] = '[NO TEXT ENTERED INTO THE MESSAGE]\\n\\n'; } } else { $message['body'] = imap_body($this->mailbox, $messageid); if (!$message['body']) { $message['body'] = '[NO TEXT ENTERED INTO THE MESSAGE]\\n\\n'; } } return $message; }
function inbox() { $this->msg_cnt = imap_num_msg($this->conn); echo "Number of emails read = " . $this->msg_cnt . "\n"; /*$in = array(); for($i = 1; $i <= $this->msg_cnt; $i++) { $in[] = array( 'index' => $i, 'header' => imap_headerinfo($this->conn, $i), 'body' => imap_body($this->conn, $i), 'structure' => imap_fetchstructure($this->conn, $i) ); */ $output = '<table>'; $output .= '<tr><th>Subject</th><th>voucher</th><th>From</th><th>seen</th><th>type</th></tr>'; $mails = imap_search($this->conn, 'FROM "*****@*****.**" SUBJECT "Confirm Hotel Booking"'); //print_r($mails); for ($i = 0; $i <= sizeof($mails); $i++) { $header = imap_fetch_overview($this->conn, $mails[$i], 0); $body = imap_fetchbody($this->conn, $mails[$i], 1.1); $output .= '<tr>'; $output .= '<td><span class="subject">' . $header[0]->subject . '</span> </td>'; $output .= '<td><span class="from">' . $header[0]->from . '</span></td>'; $output .= '<td><span class="voucher">' . $mails[0]->voucher . '</span></td>'; $output .= '<td><span class="date">' . $header[0]->date . '</span></td>>'; $output .= '<td><span class="toggler">' . ($header[0]->seen ? 'read' : 'unread') . '"></span></td>'; $structure = imap_fetchstructure($this->conn, $mails[$i]); $output .= '<td><span class="type">' . $structure->type . '</span> </td>'; $output .= '</tr>'; } $output .= '</table>'; echo $output . "\n"; }
/** * @param string $criteria * @return $this */ public function messages($criteria) { $this->messages = array_map(function ($messageNumber) { return array('id' => $messageNumber, 'header' => imap_header($this->mailbox, $messageNumber), 'struct' => imap_fetchstructure($this->mailbox, $messageNumber)); }, imap_search($this->mailbox, $criteria)); return $this; }
/** * * @return ImapMessagePart */ public function getBody() { if ($this->body === null) { $partsStructure = \imap_fetchstructure($this->imapResource, $this->uid, \FT_UID); $this->body = new ImapMessagePart($this->imapResource, $this->uid, $partsStructure); } return $this->body; }
public function fetchStructure() { $structure = imap_fetchstructure($this->stream, $this->number); if (FALSE === $structure) { throw new Exception('FetchStructure failed: ' . imap_last_error()); } return $structure; }
public function __construct(IMAP $imap, $mail, $attachmentsDirectory = null) { $this->imap = $imap; $this->connection = $imap->getConnection(); $this->mail = $mail; $this->attachmentsDirectory = $attachmentsDirectory; $this->structure = imap_fetchstructure($this->connection, $this->mail->id, FT_UID); }
public function getStructure() { $structure = @imap_fetchstructure($this->_connection->getConnection(), $this->_messageNumber); if (!$structure) { throw new Exception('Failed to fetch message structure.'); } return $structure; }
function inbox() { $this->msg_cnt = imap_num_msg($this->conn); $in = array(); for ($i = 1; $i <= 20; $i++) { $in[] = array('index' => $i, 'header' => imap_headerinfo($this->conn, $i), 'body' => imap_body($this->conn, $i), 'structure' => imap_fetchstructure($this->conn, $i)); } $this->inbox = $in; }
public function mimeToArray($imap, $mid, $parse_headers = false) { $mail = imap_fetchstructure($this->conn, $mid); $mail = $this->getParts($this->conn, $mid, $mail, 0); if ($parse_headers) { $mail[0]["parsed"] = $this->parseHeaders($mail[0]["data"]); } return $mail; }
function mail_mime_to_array($imap, $mid, $parse_headers = false) { $mail = imap_fetchstructure($imap, $mid); $mail = $this->mail_get_parts($imap, $mid, $mail, 0); if ($parse_headers) { $mail[0]["parsed"] = $this->mail_parse_headers($mail[0]["data"]); } return $mail; }
function parsebody($conn, $msgno) { $body = imap_fetchstructure($conn, $msgno); $att = false; $attachment = array(); $inline = array(); $content = ''; return parseparts($conn, $msgno, $body, $attachment, $inline, $content); }
public function fetch() { $structure = @imap_fetchstructure($this->connection, $this->messageNumber, FT_UID); if (!$structure) { return false; } else { $this->recurse($structure->parts); return true; } }
/** * Get messages according to a search criteria * * @param string search criteria (RFC2060, sec. 6.4.4). Set to "UNSEEN" by default * NB: Search criteria only affects IMAP mailboxes. * @param string date format. Set to "Y-m-d H:i:s" by default * @return mixed array containing messages */ public function get_messages($search_criteria = "UNSEEN", $date_format = "Y-m-d H:i:s") { //$msgs = imap_num_msg($this->imap_stream); $no_of_msgs = imap_num_msg($this->imap_stream); $messages = array(); for ($i = 1; $i <= $no_of_msgs; $i++) { $header = imap_headerinfo($this->imap_stream, $i); $message_id = $header->message_id; $date = date($date_format, $header->udate); if (isset($header->from)) { $from = $header->from; } else { $from = FALSE; } $fromname = ""; $fromaddress = ""; $subject = ""; if ($from != FALSE) { foreach ($from as $id => $object) { if (isset($object->personal)) { $fromname = $object->personal; } $fromaddress = $object->mailbox . "@" . $object->host; if ($fromname == "") { // In case from object doesn't have Name $fromname = $fromaddress; } } } if (isset($header->subject)) { $subject = $this->_mime_decode($header->subject); } // Read the message structure $structure = imap_fetchstructure($this->imap_stream, $i); if (!empty($structure->parts)) { for ($j = 0, $k = count($structure->parts); $j < $k; $j++) { $part = $structure->parts[$j]; if ($part->subtype == 'PLAIN') { $body = imap_fetchbody($this->imap_stream, $i, $j + 1); } } } else { $body = imap_body($this->imap_stream, $i); } // Convert quoted-printable strings (RFC2045) $body = imap_qprint($body); // Convert to valid UTF8 $body = htmlentities($body); $subject = htmlentities($subject); array_push($messages, array('message_id' => $message_id, 'date' => $date, 'from' => $fromname, 'email' => $fromaddress, 'subject' => $subject, 'body' => $body)); // Mark Message As Read imap_setflag_full($this->imap_stream, $i, "\\Seen"); } return $messages; }
function pop3_body() { $imap = imap_open("{pop.163.com:110/pop3/notls}", "rong360credit01", "rong36000"); $message_count = imap_num_msg($imap); for ($i = 1; $i <= $message_count; ++$i) { $header = imap_header($imap, $i); $date = $header->date; echo "************msg no: {$i} \n {$date} \n"; $structure = imap_fetchstructure($imap, $i); // print_r($structure) ; } imap_close($imap); }
function retrieve_message($mbox, $messageid, $including = 0) { $message = ''; $structure = imap_fetchstructure($mbox, $messageid); if ($structure->type == 1) { // Если MULTI-PART письмо $message = imap_fetchbody($mbox, $messageid, $including + 1); $parameters = $structure->parts[$including]->parameters; $encoding = $structure->parts[$including]->encoding; } else { $message = imap_body($mbox, $messageid); $parameters = $structure->parameters; $encoding = $structure->encoding; } // if switch ($encoding) { // Декодируем case 0: // 7BIT // 7BIT case 1: // 8BIT // 8BIT case 2: // BINARY break; case 3: // BASE64 $message = base64_decode($message); break; case 4: // QUOTED-PRINTABLE $message = quoted_printable_decode($message); break; case 5: // OTHER // OTHER default: // UNKNOWN return; } // switch $charset = ''; for ($i = 0; $i < count($parameters); $i++) { if ($parameters[$i]->attribute == 'charset') { $charset = $parameters[$i]->value; } } return array($message, $charset); }
/** * @param $mid */ private static function getMsg($mid) { self::$htmlmsg = false; self::$plainmsg = false; self::$charset = false; self::$attachments = array(); $s = imap_fetchstructure(self::$mbox, $mid); if (!$s->parts) { self::getPart($mid, $s, 0); } else { foreach ($s->parts as $part => $p) { self::getPart($mid, $p, $part + 1); } } }
function get_attachment_info($mbox_stream, $msg_number) { $structure = imap_fetchstructure($mbox_stream, $msg_number, FT_UID); $contentParts = count($structure->parts); $msg_info['number_attachments'] = $contentParts - 1; if ($contentParts > 1) { for ($i = 1; $i < $contentParts; ++$i) { $msg_info['attachment'][$i]['part_in_msg'] = $i + 1; $msg_info['attachment'][$i]['name'] = urlencode($structure->parts[$i]->dparameters[0]->value); $msg_info['attachment'][$i]['type'] = $structure->parts[$i]->subtype; $msg_info['attachment'][$i]['bytes'] = $structure->parts[$i]->bytes; } } return $msg_info; }
public function __construct($Number, &$Mailbox) { $this->Mailbox =& $Mailbox; $Connection =& $this->Mailbox->Connection; $Tmp = imap_fetch_overview($Connection, $Number); $this->Overview = $Tmp[0]; $this->Structure = imap_fetchstructure($Connection, $Number); $this->HeaderInfo = imap_headerinfo($Connection, $Number); $this->MailDateTime = Gdn_Format::ToDateTime($this->HeaderInfo->udate); $this->Number = $this->Overview->msgno; $this->Uid = $this->Overview->uid; $this->RetrieveInfo(); $this->RetrieveBodyText(); $this->RetrieveAttachments(); return $this; }
function email_get_msg($mbox, $uid, $reply) { $ret = array(); $struc = $mbox && $uid ? @imap_fetchstructure($mbox, $uid, FT_UID) : null; if (!$struc) { return $ret; } // for testing purposes: Collect imported mails // $file = tempnam("/tmp/friendica2/", "mail-in-"); // file_put_contents($file, json_encode($struc)); if (!$struc->parts) { $ret['body'] = email_get_part($mbox, $uid, $struc, 0, 'html'); $html = $ret['body']; if (trim($ret['body']) == '') { $ret['body'] = email_get_part($mbox, $uid, $struc, 0, 'plain'); } else { $ret['body'] = html2bbcode($ret['body']); } } else { $text = ''; $html = ''; foreach ($struc->parts as $ptop => $p) { $x = email_get_part($mbox, $uid, $p, $ptop + 1, 'plain'); if ($x) { $text .= $x; } $x = email_get_part($mbox, $uid, $p, $ptop + 1, 'html'); if ($x) { $html .= $x; } } if (trim($html) != '') { $ret['body'] = html2bbcode($html); } else { $ret['body'] = $text; } } $ret['body'] = removegpg($ret['body']); $msg = removesig($ret['body']); $ret['body'] = $msg['body']; $ret['body'] = convertquote($ret['body'], $reply); if (trim($html) != '') { $ret['body'] = removelinebreak($ret['body']); } $ret['body'] = unifyattributionline($ret['body']); return $ret; }
/** * Recupera o conteúdo de uma mensagem * @param MailContext $context Contexto da conexão * @param Message $message * @return Message A própria mensagem * @throws MailStateException Caso o estado do objeto não implemente abertura * @throws MailException Caso não seja possível recuperar o conteúdo da mensagem */ public function fetch( MailContext $context , Message $message ) { $msgNum = imap_msgno( ImapState::$resource , $message->getUID() ); $structure = imap_fetchstructure( ImapState::$resource , $msgNum ); $overview = (array) current( imap_fetch_overview( ImapState::$resource , $msgNum ) ); $message->setHeaders( imap_fetchheader( ImapState::$resource , $msgNum ) ); $message->setOverview( $overview ); if ( isset( $structure->parts ) && count( $structure->parts ) ) { foreach ( $structure->parts as $key => $part ) { $this->fetchContent( $message , $part->subtype , $msgNum , $key + 1 ); } } else { $this->fetchContent( $message , $structure->subtype , $msgNum , 1 ); } }
public function free($util) { $stream = imap_open("{imap.club-internet.fr:993/imap/SSL}", $util, "wrasuxwr"); var_dump($stream); $check = imap_check($stream); $list = imap_list($stream, "{imap.club-internet.fr}", "*"); imap_createmailbox($stream, '{imap.club-internet.fr}brubru'); $getmailboxes = imap_getmailboxes($stream, "{imap.club-internet.fr}", "*"); $headers = imap_headers($stream); $num_msg = imap_num_msg($stream); $status = imap_status($stream, "{imap.club-internet.fr:993/imap/SSL}INBOX", SA_ALL); $messages = imap_fetch_overview($stream, "1:" . $num_msg); $structure = imap_fetchstructure($stream, 2); $body = utf8_encode(quoted_printable_decode(imap_body($stream, '2'))); // imap_delete($stream, '1'); // imap_expunge($stream); return view('Imap.Imap')->with(compact('resource'))->with(compact('check'))->with(compact('list'))->with(compact('getmailboxes'))->with(compact('headers'))->with(compact('num_msg'))->with(compact('status'))->with(compact('errors'))->with(compact('messages'))->with(compact('structure'))->with(compact('body')); }
function get_msg($mid) { $ret = new \stdClass(); $ret->htmlmsg = $ret->plainmsg = $ret->charset = ''; $ret->attachments = array(); // BODY $s = imap_fetchstructure($this->con, $mid); if (empty($s->parts)) { // simple $this->get_part($ret, $mid, $s, 0); } else { // multipart: cycle through each part foreach ($s->parts as $partno0 => $p) { $this->get_part($ret, $mid, $p, $partno0 + 1); } } return $ret; }
function get_fetchstructure($msg_number) { if (isset($this->fetchstructure[$msg_number])) { return $this->fetchstructure[$msg_number]; } $this->fetchstructure[$msg_number] = imap_fetchstructure($this->imap, $msg_number); return $this->fetchstructure[$msg_number]; }