class

Marten::Emailing::Email

Inherits Marten::Template::Object::Auto / Marten::Template::Object / Marten::Template::CanDefineTemplateAttributes / Marten::Emailing::Email::Callbacks / Reference / Object

Abstract base email class.

This class holds the definition of a single email. It is supposed to be subclassed and each subclass is responsible for defining how it should be initialized, the email properties, and how it should be rendered (for example, using a specific HTML template).

Class methods

backend(backend : Backend::Base) : Nil

Allows to set the specific backend to use for this email.

Source
backend

Returns the specific backend to use for this email.

A nil value indicate that the default backend will be used.

Source
html_template_name

Returns the configured HTML body template name.

Source
template_name(template_name : String | Nil, content_type : ContentType | String | Symbol = ContentType::HTML) : Nil

Allows to configure the template that should be rendered when generating the body of the email.

Source
text_template_name

Returns the configured text body template name.

Source

Instance methods

backend

Returns the emailing backend to use in order to send this email.

Source
bcc

Returns the email addresses the email should be BBC'ed to.

Source
cc

Returns the email addresses the email should be CC'ed to.

Source
context

Returns the global template context.

This context object can be mutated for the lifetime of the email in order to define which variables will be made available to the template runtime when rendering the email body.

Source
deliver

Delivers the email.

Source
from

Returns the sender email address.

Source
headers

Returns the headers to set on the email.

Source
html_body

Returns the HTML body.

Source
html_template_name

Returns the template name that should be used to render the HTML body.

Source
reply_to

Returns the reply-to email address.

Source
subject

Returns the subject of the email.

Source
text_body

Returns the text body.

Source
text_template_name

Returns the template name that should be used to render the text body.

Source
to

Returns an array of recipient email addresses.

Source

Macros

bcc(value)

Allows to define the email addresses the email should be BBC'ed to.

Source
cc(value)

Allows to define the email addresses the email should be BC'ed to.

Source
from(value)

Allows to define the sender email address.

Source
reply_to(value)

Allows to define the reply-to email address.

Source
subject(value)

Allows to define the subject of the email.

Source
to(value)

Allows to define the email addresses of the recipients of the email.

Source

Nested types