title: get attachment info with php mime_parser
body: <p>I am trying to get the information from an XML file that is being sent as an attachment on an email with php.  I'm using mime_parser.php to parse the email.  Here is the code I'm working with:</p>
  
  <pre><code>$email = "";
  while (!feof($fd)) {
  $email .= fread($fd, 1024);
  }
  fclose($fd);
  
  //SET UP EMAIL PARSER CLASS
  $mime=new mime_parser_class;
  $mime-&gt;ignore_syntax_errors = 1;
  $parameters=array('Data'=&gt;$email,);
  
  //RESULTS GET ADDED TO $decoded VARIABLE
  $mime-&gt;Decode($parameters, $decoded);
  
  //---------------------- GET EMAIL HEADER INFO -----------------------//
  
  //get the name and email of the sender
  $fromName = $decoded[0]['ExtractedAddresses']['from:'][0]['name'];
  $fromEmail = $decoded[0]['ExtractedAddresses']['from:'][0]['address'];
  
  //get the name and email of the recipient
  $toEmail = $decoded[0]['ExtractedAddresses']['to:'][0]['address'];
  $toName = $decoded[0]['ExtractedAddresses']['to:'][0]['name'];
  
  //get the subject
  $subject = $decoded[0]['Headers']['subject:'];
  
  $removeChars = array('&lt;','&gt;');
  
  //get the message id
  $messageID = str_replace($removeChars,'',$decoded[0]['Headers']['message-id:']);
  
  //get the reply id
  $replyToID = str_replace($removeChars,'',$decoded[0]['Headers']['in-reply-to:']);
  //---------------------- END GET EMAIL HEADER INFO -----------------------//
  
  //---------------------- FIND THE BODY -----------------------//
  //get the message body
  if(substr($decoded[0]['Headers']['content-type:'],0,strlen('text/plain')) == 'text/plain' &amp;&amp; isset($decoded[0]['Body'])){
      $body = $decoded[0]['Body'];
  } elseif(substr($decoded[0]['Parts'][0]['Headers']['content-type:'],0,strlen('text/plain')) == 'text/plain' &amp;&amp; isset($decoded[0]['Parts'][0]['Body'])) {
      $body = $decoded[0]['Parts'][0]['Body'];
  } elseif(substr($decoded[0]['Parts'][0]['Parts'][0]['Headers']['content-type:'],0,strlen('text/plain')) == 'text/plain' &amp;&amp; isset($decoded[0]['Parts'][0]['Parts'][0]['Body'])) {
      $body = $decoded[0]['Parts'][0]['Parts'][0]['Body'];
  }
  //---------------------- END FIND THE BODY -----------------------//
  </code></pre>
  
  <p>I can't find anything on how to get the attachment info.  A few examples showed it as being part of the header but as far as I can tell it is not.  If anyone has info on where the attachment info is I'd appreciate it.</p>