Links

Mailers

Mailers are implemented using the Quartz-Mailer library. This library is required by default within config/mailer.cr.

Define a Mailer

The mailer has the ability to set the from, to, cc, bcc, and subject as well as both text and html body formats. You may use the render helper to create the body of the email.
class WelcomeMailer < Quartz::Composer
def sender
address email: "[email protected]", name: "Amber"
end
def initialize(name : String, email : String)
to email: email, name: name # Can be called multiple times to add more recipients
subject "Welcome to Amber"
text render("mailers/welcome_mailer.text.ecr")
html render("mailers/welcome_mailer.html.slang", "mailer-layout.html.slang")
end
end

Deliver an Email

WelcomeMailer.new(name, email).deliver