You are here

function mimemail_parse_attachment in Mime Mail 6

Same name and namespace in other branches
  1. 5 mimemail.inc \mimemail_parse_attachment()
  2. 7 includes/mimemail.incoming.inc \mimemail_parse_attachment()
1 call to mimemail_parse_attachment()
mimemail_parse in ./mimemail.inc

File

./mimemail.inc, line 569
Common mail functions for sending e-mail. Originally written by Gerhard.

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),
  );
}