mailjet
Version, currently 0.2.06 versions
github.com/wout/mailjet.cr
Mailjet API Client for Crystal https://app.mailjet.com
Nothing has been indexed for 0.2.0 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
mailjet:
github: wout/mailjet.cr
version: ~> 0.2.0Then run:
shards installshard.yml
No shard.yml has been indexed for 0.2.0. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
Mailjet API client for Crystal
Mailjet is an email platform for teams to send transactional & marketing emails. It is a GDPR compliant and ISO 27001 certified Email Service Provider.
Disclaimer
This is the unofficial Crystal shard for Mailjet. The majority of the API is covered, but some parts still need to be added.
Requirements
To use the Mailjet API client, you will need a free Mailjet account.
Installation
- Add the dependency to your
shard.yml:
dependencies:
mailjet:
github: wout/mailjet.cr
- Run
shards install
Usage
Include the shard
require "mailjet"
Configure your crendentials
Mailjet.configure do |settings|
settings.api_key = "your-api-key"
settings.secret_key = "your-secret-key"
settings.default_from = "noreply@email.com"
end
Send your first email
response = Mailjet::SendV3_1.message({
"From": {
"Email": "from@email.com",
"Name": "Me",
},
"To": [
{
"Email": "to@email.com",
"Name": "You",
},
],
"Subject": "My first Mailjet Email!",
"TextPart": "Greetings from Mailjet!",
"HTMLPart": <<-HTML
<h3>
Dear passenger 1, welcome to
<a href='https://www.mailjet.com/'>Mailjet</a>!
</h3>
<br />
May the delivery force be with you!
HTML
})
puts response.status
# => "success"
Send multiple messages
response = Mailjet::SendV3_1.messages([
{...},
{...}
])
puts response.first.status
# => "success"
Retrieve sent messages
Now, let’s view the status of the sent message and its configuration specifics.
message = Mailjet::Message.find(576460754655154659)
puts message.status
# => "opened"
View message history
You can track important events linked to the sent emails, for example whether the recipient opened the message, or clicked on a link within.
events = Mailjet::Messagehistory.all(576460754655154659)
puts events.first.event_type
# => "sent"
puts events.last.event_type
# => "opened"
Retrieve Statistics
The Mailjet API also has a variety of resources that help retrieve aggregated statistics for key performance indicators like opens, clicks, unsubscribes, etc.
Let's take a look at just one of those resources to give you a sample of the data you can read - we’ll retrieve total aggregated statistics for your API key.
counters = Mailjet::Statcounters.by_api_key({
counter_timing: "event",
counter_resolution: "hour",
from_ts: Time.local.at_beginning_of_day.to_unix,
to_ts: Time.local.to_unix,
})
puts counters.first.event_opened_count
# => 28
Temporarily use other settings
Mailjet.temp_config(api_version: Mailjet::Api::V3_1) do
# ... do something ...
end
Documentation
To-do
Most of the API is covered, but the following endpoints are not:
- [ ] All Message Events
- [ ] Bulk contact management and CSV import
- [ ] Parse
- [ ] Settings
- [ ] SMS
- [ ] Statistics (only statcounters is done)
- [ ] Webhook
Contributing
- Fork it (https://github.com/wout/mailjet.cr/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'feat: add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- wout - creator and maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.2.0- Tagged
- Apr 30, 2024
- Commit
9fbb067eb2b5- Indexed
- not yet
Dependents
Repository
github.com/wout/mailjet.cr
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 19, 2026
- Synced
- Aug 19, 2026
- Versions
- 6