Message
class Message extends MimePart
Represents an email message with support for HTML body, attachments, and embedded files.
Constants
| High |
Priority |
| Normal |
Priority |
| Low |
Priority |
| HIGH |
|
| NORMAL |
|
| LOW |
|
Properties
| static array<string,string> | $defaultHeaders |
Methods
No description
Sets the sender of the message. Email or format "John Doe" doe@example.com
Returns the sender of the message.
Adds the reply-to address. Email or format "John Doe" doe@example.com
No description
No description
Adds email recipient. Email or format "John Doe" doe@example.com
Adds carbon copy email recipient. Email or format "John Doe" doe@example.com
Adds blind carbon copy email recipient. Email or format "John Doe" doe@example.com
No description
No description
No description
No description
Sets HTML body. If $basePath is provided, local images referenced in the HTML are automatically embedded as inline attachments with their src rewritten to cid: URIs.
No description
No description
Adds an embedded (inline) file. If $content is null, the file is read from disk.
Adds an attachment. If $content is null, the file is read from disk.
No description
Returns encoded message.
Details
at line 52
__construct()
No description
at line 65
Message
setFrom(string $email, string|null $name = null)
Sets the sender of the message. Email or format "John Doe" doe@example.com
at line 76
array|null
getFrom()
Returns the sender of the message.
at line 86
Message
addReplyTo(string $email, string|null $name = null)
Adds the reply-to address. Email or format "John Doe" doe@example.com
at line 93
Message
setSubject(string $subject)
No description
at line 100
string|null
getSubject()
No description
at line 110
Message
addTo(string $email, string|null $name = null)
Adds email recipient. Email or format "John Doe" doe@example.com
at line 120
Message
addCc(string $email, string|null $name = null)
Adds carbon copy email recipient. Email or format "John Doe" doe@example.com
at line 130
Message
addBcc(string $email, string|null $name = null)
Adds blind carbon copy email recipient. Email or format "John Doe" doe@example.com
at line 156
Message
setReturnPath(string $email)
No description
at line 163
string|null
getReturnPath()
No description
at line 170
Message
setPriority(int $priority)
No description
at line 177
int|null
getPriority()
No description
at line 189
Message
setHtmlBody(string $html, string|null $basePath = null)
Sets HTML body. If $basePath is provided, local images referenced in the HTML are automatically embedded as inline attachments with their src rewritten to cid: URIs.
Also sets the subject from the HTML
at line 200
string
getHtmlBody()
No description
at line 207
void
setRawHtmlBody(string $html)
| internal | used by HtmlComposer |
No description
at line 217
MimePart
addEmbeddedFile(string $file, string|null $content = null, string|null $contentType = null)
Adds an embedded (inline) file. If $content is null, the file is read from disk.
In that case $file is the path; otherwise $file is used as the filename.
at line 227
Message
addInlinePart(MimePart $part)
Adds a pre-built MIME part as an inline (embedded) attachment.
at line 238
MimePart
addAttachment(string $file, string|null $content = null, string|null $contentType = null)
Adds an attachment. If $content is null, the file is read from disk.
In that case $file is the path; otherwise $file is used as the filename.
at line 247
array
getAttachments()
No description
at line 295
string
generateMessage()
Returns encoded message.
at line 304
Message
build()
Builds email. Does not modify itself, but returns a new object.