mini\Mail\Message
class
Documentation
MIME Message - Single-part message (text, HTML, attachment, etc.)
Implements PSR-7 MessageInterface with a StreamInterface body.
Usage:
// Simple text message
$msg = new Message('text/plain', 'Hello, World!');
// HTML message
$msg = new Message('text/html', '<h1>Hello</h1>');
// From file (auto-detects MIME type)
$msg = Message::fromFile('document.pdf');
// From stream resource
$msg = new Message('image/png', fopen('image.png', 'rb'));
// From existing StreamInterface (e.g., Base64Stream)
$msg = new Message('image/png', new Base64Stream($rawStream));
Inheritance
Implements:
Psr\Http\Message\MessageInterface
Constants (1)
| Name | Value |
|---|---|
MIME_TYPES |
array (
'txt' => 'text/plain',
'html' => 'text/html',
'htm' => 'text/html',
'css' => 'text/css',
'js' => 'application/javascript',
'json' => 'application/json',
'xml' => 'application/xml',
'pdf' => 'application/pdf',
'zip' => 'application/zip',
'gz' => 'application/gzip',
'tar' => 'application/x-tar',
'gif' => 'image/gif',
'jpg' => 'image/jpeg',
'jpeg' => 'image/jpeg',
'png' => 'image/png',
'webp' => 'image/webp',
'svg' => 'image/svg+xml',
'ico' => 'image/x-icon',
'mp3' => 'audio/mpeg',
'wav' => 'audio/wav',
'mp4' => 'video/mp4',
'webm' => 'video/webm',
'woff' => 'font/woff',
'woff2' => 'font/woff2',
'ttf' => 'font/ttf',
'otf' => 'font/otf',
'csv' => 'text/csv',
'doc' => 'application/msword',
'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'xls' => 'application/vnd.ms-excel',
'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
) |
Properties (4)
protected
string $protocolVersion
protected
array $headers
protected
array $headerCases
protected
Psr\Http\Message\StreamInterface $body
Methods (16)
Create a MIME message from a file
Detect MIME type from file path
Create a MIME message
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Get the message body
Return an instance with the specified message body
Get the Content-Type header value
Return instance with specified Content-Type