quartz_mailer
Version, currently 0.8.015 versions
- 0.8.0latestJun 7, 2021
- 0.7.2not indexedJun 7, 2021
- 0.7.1not indexedJun 7, 2021
- 0.7.0not indexedJun 7, 2021
- 0.6.0not indexedJun 7, 2021
- 0.5.4not indexedJun 7, 2021
- 0.5.3not indexedJun 7, 2021
- 0.5.2not indexedJun 7, 2021
- 0.5.1not indexedJun 7, 2021
- 0.5.0not indexedJun 7, 2021
- 0.4.0not indexedJun 7, 2021
- 0.3.0not indexedJun 7, 2021
- 0.2.1not indexedJun 7, 2021
- 0.2.0not indexedJun 7, 2021
- 0.1.0not indexedJun 7, 2021
github.com/amberframework/quartz-mailer
A library to get started in sending and receiving emails from and to your Crystal application
24 stars
2 dependents
License: MIT
Installation
# Add this to your shard.yml
dependencies:
quartz_mailer:
github: amberframework/quartz-mailer
version: ~> 0.8.0Then run:
shards installshard.yml
- Crystal
>= 0.33.0, < 2.0.0- License
- MIT
Dependencies
Runtime Dependencies
README
# Quartz-Mailer
[](https://travis-ci.org/amberframework/quartz-mailer)
A library to send emails from your Crystal application.
## Installation
Add this to your application's `shard.yml`:
```yaml
dependencies:
quartz_mailer:
github: amberframework/quartz-mailer
```
## Usage
```crystal
require "quartz_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 can also add custom headers using `header` method.
A `render` helper provides friendly markup rendering with [jeromegn/kilt](https://github.com/jeromegn/kilt).
```crystal
class WelcomeMailer < Quartz::Composer
def sender
address email: "info@amberframework.org", name: "Amber"
end
def initialize(name : String, email : String)
to name: name, email: email # Can be called multiple times to add more recipients
subject "Welcome to Amber"
header "X-Custom-Header", "value" # Can be called multiple times to add more custom headers
text render("mailers/welcome_mailer.text.ecr")
html render("mailers/welcome_mailer.html.slang", "mailer-layout.html.slang")
end
end
```
To deliver a new email:
```crystal
WelcomeMailer.new(name, email).deliver
```
To remove a recipient:
```crystal
remove_to_recipient email: "to@foobar.com"
remove_cc_recipient email: "cc@foobar.com"
remove_bcc_recipient email: "bcc@foobar.com"
```
## Multiple Recipient Example:
```crystal
class MultipleRecipientMailer < Quartz::Composer
def sender
address email: "info@amberframework.org", name: "Amber"
end
def initialize(to_emails : Array(String), cc_emails = [] of String, bcc_emails = [] of String, headers = {} of String => String)
to_emails.each do |email|
to email
end
cc_emails.each do |email|
cc email
end
bcc_emails.each do |email|
bcc email
end
headers.each do |name, value|
header name, value
end
subject "Welcome to Amber"
text render("mailers/welcome_mailer.text.ecr")
html render("mailers/welcome_mailer.html.slang", "mailer-layout.html.slang")
end
end
MultipleRecipientMailer.new(email_addrs, cc_email_addrs, bcc_email_addrs).deliver
```
## Contributing
1. Fork it ( https://github.com/amber-crystal/quartz-mailer/fork )
2. Create your feature branch (git checkout -b my-new-feature)
3. Commit your changes (git commit -am 'Add some feature')
4. Push to the branch (git push origin my-new-feature)
5. Create a new Pull Request
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.8.0- Tagged
- Jun 7, 2021
- Commit
5c5b35c60ef8- Crystal
>= 0.33.0, < 2.0.0- Indexed
- yes
Dependents
Repository
github.com/amberframework/quartz-mailer
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 12, 2026
- Synced
- Aug 12, 2026
- Versions
- 15