You are here

function mimemail_parse_boundary in Mime Mail 7

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

Split a multi-part message using MIME boundaries.

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

File

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

Code

function mimemail_parse_boundary($part) {
  $m = array();
  if (preg_match('/.*boundary="?([^";]+)"?.*/', $part['headers']['Content-Type'], $m)) {
    $boundary = "\n--" . $m[1];
    $body = str_replace("{$boundary}--", '', $part['body']);
    return array_slice(explode($boundary, $body), 1);
  }
  return array(
    $part['body'],
  );
}