You are here

function mimemail_parse_attachment in Mime Mail 7

Same name and namespace in other branches
  1. 5 mimemail.inc \mimemail_parse_attachment()
  2. 6 mimemail.inc \mimemail_parse_attachment()

Convert a MIME part into a file array.

1 call to mimemail_parse_attachment()
mimemail_parse in includes/mimemail.incoming.inc
Parses a message into its parts.

File

includes/mimemail.incoming.inc, line 199
Functions that handle inbound messages to mimemail.

Code

function mimemail_parse_attachment($part) {
  $m = array();
  if (preg_match('/.*filename="?([^";])"?.*/', $part['headers']['Content-Disposition'], $m)) {
    $name = $m[1];
  }
  elseif (preg_match('/.*name="?([^";])"?.*/', $part['headers']['Content-Type'], $m)) {
    $name = $m[1];
  }
  return array(
    'filename' => $name,
    'filemime' => $part['content-type'],
    'content' => mimemail_parse_content($part),
  );
}