struct
Amber::Mailer::Email
- Amber::Mailer::Email
- Struct
- Value
- Object
Overview
Represents a fully constructed email message ready for delivery.
An Email contains all the headers, body content, and attachments needed
to generate a complete MIME message. Emails are typically built by the
Base mailer class and passed to a DeliveryAdapter for sending.
Example
email = Email.new(
to: ["[email protected]"],
from: "[email protected]",
subject: "Hello",
html_body: "<h1>Hello!</h1>",
text_body: "Hello!"
)
mime_message = email.to_mime
Defined in:
amber/mailer/email.crConstructors
Instance Method Summary
-
#all_recipients : Array(String)
Returns all recipient addresses (to + cc + bcc) for SMTP envelope delivery.
- #attachments : Array(Attachment)
- #attachments=(attachments : Array(Attachment))
- #bcc : Array(String)
- #bcc=(bcc : Array(String))
- #cc : Array(String)
- #cc=(cc : Array(String))
- #from : String
- #from=(from : String)
- #headers : Hash(String, String)
- #headers=(headers : Hash(String, String))
- #html_body : String | Nil
- #html_body=(html_body : String | Nil)
- #reply_to : String | Nil
- #reply_to=(reply_to : String | Nil)
- #subject : String
- #subject=(subject : String)
- #text_body : String | Nil
- #text_body=(text_body : String | Nil)
- #to : Array(String)
- #to=(to : Array(String))
-
#to_mime : String
Generates a complete MIME-formatted email message string.
Constructor Detail
def self.new(to : Array(String) = [] of String, from : String = "", subject : String = "", cc : Array(String) = [] of String, bcc : Array(String) = [] of String, reply_to : String | Nil = nil, html_body : String | Nil = nil, text_body : String | Nil = nil, headers : Hash(String, String) = {} of String => String, attachments : Array(Attachment) = [] of Attachment)
#
Instance Method Detail
Returns all recipient addresses (to + cc + bcc) for SMTP envelope delivery.
Generates a complete MIME-formatted email message string.
The MIME structure depends on the content present:
- Text only: single-part text/plain
- HTML only: single-part text/html
- Text + HTML: multipart/alternative
- With attachments: multipart/mixed wrapping the body parts