You are here

function mailhandler_get_mime_type in Mailhandler 5

Same name and namespace in other branches
  1. 6 mailhandler.retrieve.inc \mailhandler_get_mime_type()
  2. 7 mailhandler.retrieve.inc \mailhandler_get_mime_type()

Retrieve MIME type of the message structure.

2 calls to mailhandler_get_mime_type()
mailhandler_get_part in ./mailhandler.module
Returns the first part with the specified mime_type
mailhandler_get_parts in ./mailhandler.module
Returns an array of parts as file objects

File

./mailhandler.module, line 604

Code

function mailhandler_get_mime_type(&$structure) {
  static $primary_mime_type = array(
    'TEXT',
    'MULTIPART',
    'MESSAGE',
    'APPLICATION',
    'AUDIO',
    'IMAGE',
    'VIDEO',
    'OTHER',
  );
  $type_id = (int) $structure->type;
  if (isset($primary_mime_type[$type_id]) && !empty($structure->subtype)) {
    return $primary_mime_type[$type_id] . '/' . $structure->subtype;
  }
  return 'TEXT/PLAIN';
}