You are here

public static function HtmlMailMime::guessMimeType in HTML Mail 8.3

Same name and namespace in other branches
  1. 8 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 247

Class

HtmlMailMime
Class HtmlMailMime.

Namespace

Drupal\htmlmail\Utility

Code

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