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

__construct()

No description

setFrom(string $email, string|null $name = null)

Sets the sender of the message. Email or format "John Doe" doe@example.com

array|null
getFrom()

Returns the sender of the message.

addReplyTo(string $email, string|null $name = null)

Adds the reply-to address. Email or format "John Doe" doe@example.com

setSubject(string $subject)

No description

string|null
getSubject()

No description

addTo(string $email, string|null $name = null)

Adds email recipient. Email or format "John Doe" doe@example.com

addCc(string $email, string|null $name = null)

Adds carbon copy email recipient. Email or format "John Doe" doe@example.com

addBcc(string $email, string|null $name = null)

Adds blind carbon copy email recipient. Email or format "John Doe" doe@example.com

setReturnPath(string $email)

No description

string|null
getReturnPath()

No description

setPriority(int $priority)

No description

int|null
getPriority()

No description

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.

string
getHtmlBody()

No description

void
setRawHtmlBody(string $html)

No description

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.

addInlinePart(MimePart $part)

Adds a pre-built MIME part as an inline (embedded) attachment.

addAttachment(string $file, string|null $content = null, string|null $contentType = null)

Adds an attachment. If $content is null, the file is read from disk.

array
getAttachments()

No description

string
generateMessage()

Returns encoded message.

build()

Builds email. Does not modify itself, but returns a new object.

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

Parameters

string $email
string|null $name

Return Value

Message

at line 76
array|null getFrom()

Returns the sender of the message.

Return Value

array|null

at line 86
Message addReplyTo(string $email, string|null $name = null)

Adds the reply-to address. Email or format "John Doe" doe@example.com

Parameters

string $email
string|null $name

Return Value

Message

at line 93
Message setSubject(string $subject)

No description

Parameters

string $subject

Return Value

Message

at line 100
string|null getSubject()

No description

Return Value

string|null

at line 110
Message addTo(string $email, string|null $name = null)

Adds email recipient. Email or format "John Doe" doe@example.com

Parameters

string $email
string|null $name

Return Value

Message

at line 120
Message addCc(string $email, string|null $name = null)

Adds carbon copy email recipient. Email or format "John Doe" doe@example.com

Parameters

string $email
string|null $name

Return Value

Message

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

Parameters

string $email
string|null $name

Return Value

Message

at line 156
Message setReturnPath(string $email)

No description

Parameters

string $email

Return Value

Message

at line 163
string|null getReturnPath()

No description

Return Value

string|null

at line 170
Message setPriority(int $priority)

No description

Parameters

int $priority

Return Value

Message

at line 177
int|null getPriority()

No description

Return Value

int|null

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 if not already set, and auto-generates a plain-text alternative.</p></p> </div> <div class="tags"> <h4>Parameters</h4> <table class="table table-condensed"> <tr> <td>string</td> <td>$html</td> <td></td> </tr> <tr> <td>string|null</td> <td>$basePath</td> <td></td> </tr> </table> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td><a href="../../Nette/Mail/Message.html"><abbr title="Nette\Mail\Message">Message</abbr></a></td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_getHtmlBody"> <div class="location">at line 200</div> <code> string <strong>getHtmlBody</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p class="no-description">No description</p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>string</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_setRawHtmlBody"> <div class="location">at line 207</div> <code> void <strong>setRawHtmlBody</strong>(string $html) </code> </h3> <div class="details"> <table> <tr> <td><span class="label label-warning">internal</span></td> <td> used by HtmlComposer</td> </tr> </table>   <div class="method-description"> <p class="no-description">No description</p> </div> <div class="tags"> <h4>Parameters</h4> <table class="table table-condensed"> <tr> <td>string</td> <td>$html</td> <td></td> </tr> </table> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>void</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_addEmbeddedFile"> <div class="location">at line 217</div> <code> <a href="../../Nette/Mail/MimePart.html"><abbr title="Nette\Mail\MimePart">MimePart</abbr></a> <strong>addEmbeddedFile</strong>(string $file, string|null $content = null, string|null $contentType = null) </code> </h3> <div class="details"> <div class="method-description"> <p><p>Adds an embedded (inline) file. If $content is null, the file is read from disk.</p></p> <p><p>In that case $file is the path; otherwise $file is used as the filename.</p></p> </div> <div class="tags"> <h4>Parameters</h4> <table class="table table-condensed"> <tr> <td>string</td> <td>$file</td> <td></td> </tr> <tr> <td>string|null</td> <td>$content</td> <td></td> </tr> <tr> <td>string|null</td> <td>$contentType</td> <td></td> </tr> </table> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td><a href="../../Nette/Mail/MimePart.html"><abbr title="Nette\Mail\MimePart">MimePart</abbr></a></td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_addInlinePart"> <div class="location">at line 227</div> <code> <a href="../../Nette/Mail/Message.html"><abbr title="Nette\Mail\Message">Message</abbr></a> <strong>addInlinePart</strong>(<a href="../../Nette/Mail/MimePart.html"><abbr title="Nette\Mail\MimePart">MimePart</abbr></a> $part) </code> </h3> <div class="details"> <div class="method-description"> <p><p>Adds a pre-built MIME part as an inline (embedded) attachment.</p></p> </div> <div class="tags"> <h4>Parameters</h4> <table class="table table-condensed"> <tr> <td><a href="../../Nette/Mail/MimePart.html"><abbr title="Nette\Mail\MimePart">MimePart</abbr></a></td> <td>$part</td> <td></td> </tr> </table> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td><a href="../../Nette/Mail/Message.html"><abbr title="Nette\Mail\Message">Message</abbr></a></td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_addAttachment"> <div class="location">at line 238</div> <code> <a href="../../Nette/Mail/MimePart.html"><abbr title="Nette\Mail\MimePart">MimePart</abbr></a> <strong>addAttachment</strong>(string $file, string|null $content = null, string|null $contentType = null) </code> </h3> <div class="details"> <div class="method-description"> <p><p>Adds an attachment. If $content is null, the file is read from disk.</p></p> <p><p>In that case $file is the path; otherwise $file is used as the filename.</p></p> </div> <div class="tags"> <h4>Parameters</h4> <table class="table table-condensed"> <tr> <td>string</td> <td>$file</td> <td></td> </tr> <tr> <td>string|null</td> <td>$content</td> <td></td> </tr> <tr> <td>string|null</td> <td>$contentType</td> <td></td> </tr> </table> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td><a href="../../Nette/Mail/MimePart.html"><abbr title="Nette\Mail\MimePart">MimePart</abbr></a></td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_getAttachments"> <div class="location">at line 247</div> <code> array <strong>getAttachments</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p class="no-description">No description</p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>array</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_generateMessage"> <div class="location">at line 295</div> <code> string <strong>generateMessage</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Returns encoded message.</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>string</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_build"> <div class="location">at line 304</div> <code> <a href="../../Nette/Mail/Message.html"><abbr title="Nette\Mail\Message">Message</abbr></a> <strong>build</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p><p>Builds email. Does not modify itself, but returns a new object.</p></p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td><a href="../../Nette/Mail/Message.html"><abbr title="Nette\Mail\Message">Message</abbr></a></td> <td></td> </tr> </table> </div> </div> </div> </div> </div><div id="footer"></div></div> </div> </body> </html>