class Marten::Emailing::Email
- Marten::Emailing::Email
- Reference
- Object
Overview
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).
Included Modules
Defined in:
marten/emailing/email.crmarten/emailing/email/callbacks.cr
marten/template/ext/emailing/email.cr
Class Method Summary
-
.backend(backend : Backend::Base) : Nil
Allows to set the specific backend to use for this email.
-
.backend : Backend::Base | Nil
Returns the specific backend to use for this email.
-
.html_template_name : String | Nil
Returns the configured HTML body template name.
-
.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.
-
.text_template_name : String | Nil
Returns the configured text body template name.
Instance Method Summary
-
#backend
Returns the emailing backend to use in order to send this email.
-
#bcc : Array(Address) | Nil
Returns the email addresses the email should be BBC'ed to.
-
#cc : Array(Address) | Nil
Returns the email addresses the email should be CC'ed to.
-
#context
Returns the global template context.
-
#deliver
Delivers the email.
-
#from : Address
Returns the sender email address.
-
#headers : Hash(String, String)
Returns the headers to set on the email.
-
#html_body : String | Nil
Returns the HTML body.
-
#html_template_name : String | Nil
Returns the template name that should be used to render the HTML body.
-
#reply_to : Address | Nil
Returns the reply-to email address.
-
#subject : String | Nil
Returns the subject of the email.
-
#text_body : String | Nil
Returns the text body.
-
#text_template_name : String | Nil
Returns the template name that should be used to render the text body.
-
#to : Array(Address)
Returns an array of recipient email addresses.
Macro Summary
-
bcc(value)
Allows to define the email addresses the email should be BBC'ed to.
-
cc(value)
Allows to define the email addresses the email should be BC'ed to.
-
from(value)
Allows to define the sender email address.
-
reply_to(value)
Allows to define the reply-to email address.
-
subject(value)
Allows to define the subject of the email.
-
to(value)
Allows to define the email addresses of the recipients of the email.
Class Method Detail
Allows to set the specific backend to use for this email.
Returns the specific backend to use for this email.
A nil
value indicate that the default backend will be used.
Allows to configure the template that should be rendered when generating the body of the email.
Instance Method Detail
Returns the email addresses the email should be BBC'ed to.
Returns the email addresses the email should be CC'ed to.
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.
Returns the template name that should be used to render the HTML body.
Returns the template name that should be used to render the text body.