{"title":"Mailers","description":"","section":"guides","version":"v1.5","path":"guides/mailers","canonical_url":"https://amberframework.org/docs/v1.5/guides/mailers","markdown_url":"https://amberframework.org/docs/v1.5/guides/mailers.md","inherited":true,"content_markdown":"# Mailers\n\nMailers are implemented using the [Quartz-Mailer](https://github.com/amberframework/quartz-mailer) library. This library is required by default within `config/mailer.cr`.\n\n## Define a Mailer\n\nThe 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.\n\n```crystal\nclass WelcomeMailer < Quartz::Composer\n  def sender\n    address email: \"info@amberframework.org\", name: \"Amber\"\n  end\n\n  def initialize(name : String, email : String)\n    to email: email, name: name # Can be called multiple times to add more recipients\n\n    subject \"Welcome to Amber\"\n\n    text render(\"mailers/welcome_mailer.text.ecr\")\n    html render(\"mailers/welcome_mailer.html.slang\", \"mailer-layout.html.slang\")\n  end\nend\n```\n\n## Deliver an Email\n\n```crystal\nWelcomeMailer.new(name, email).deliver\n```"}