public static function PHPMailer::filenameToType
Search API
5.x PHPMailer.php | public static PHPMailer::filenameToType($filename) |
Map a file name to a MIME type. Defaults to 'application/octet-stream', i.e.. arbitrary binary data.
Parameters
string $filename A file name or full path, does not need to exist as a file:
Return value
string
4 calls to PHPMailer::filenameToType()
- PHPMailer::addAttachment in inc/
PHPMailer/ src/ PHPMailer.php - Add an attachment from a path on the filesystem. Never use a user-supplied path to a file! Returns false if the file could not be found or read. Explicitly *does not* support passing URLs; PHPMailer is not an HTTP client. If you need to do that, fetch…
- PHPMailer::addEmbeddedImage in inc/
PHPMailer/ src/ PHPMailer.php - Add an embedded (inline) attachment from a file. This can include images, sounds, and just about any other document type. These differ from 'regular' attachments in that they are intended to be displayed inline with the message, not just…
- PHPMailer::addStringAttachment in inc/
PHPMailer/ src/ PHPMailer.php - Add a string or binary attachment (non-filesystem). This method can be used to attach ascii or binary data, such as a BLOB record from a database.
- PHPMailer::addStringEmbeddedImage in inc/
PHPMailer/ src/ PHPMailer.php - Add an embedded stringified attachment. This can include images, sounds, and just about any other document type. If your filename doesn't contain an extension, be sure to set the $type to an appropriate MIME type.
File
- inc/
PHPMailer/ src/ PHPMailer.php, line 4122
Class
- PHPMailer
- PHPMailer - PHP email creation and transport class.
Namespace
PHPMailer\PHPMailerCode
public static function filenameToType($filename)
{
// In case the path is a URL, strip any query string before getting extension
$qpos = strpos($filename, '?');
if (false !== $qpos) {
$filename = substr($filename, 0, $qpos);
}
$ext = static::mb_pathinfo($filename, PATHINFO_EXTENSION);
return static::_mime_types($ext);
}