You are here

public static function HTMLMailMime::guessMimeType in HTML Mail 8

Same name and namespace in other branches
  1. 8.3 src/Utility/HtmlMailMime.php \Drupal\htmlmail\Utility\HtmlMailMime::guessMimeType()

Guess the content type of a file or inline data stream.

Uses the Mime Detect module if available; otherwise uses the file_get_mimetype() function. Provides a smaller-than-default mime-type mapping to improve performance a bit.

Parameters

string $filename: The name of the file, used for guessing the mime type based on the filename extension.

Return value

string The MIME content-type matching the file contents or filename extension, or "application/octet-stream" if no match could be found.

1 call to HTMLMailMime::guessMimeType()
HTMLMailMime::addHtmlImage in src/Utility/HTMLMailMime.php
Adds an image to the list of embedded images.

File

src/Utility/HTMLMailMime.php, line 237
Provides the MailMIME class for creating MIME-formatted email messages.

Class

HTMLMailMime
Class HTMLMailMime.

Namespace

Drupal\htmlmail\Utility

Code

public static function guessMimeType($filename) {
  return self::$mimeTypeGuesser
    ->guess($filename);
}