Scripts d'exemple avec Mailjet et Ruby.

Description

Maijet's official Ruby wrapper allows you to send transactional emails through Mailjet API in Rails 3, Manage your lists, contacts and campaigns and Track email delivery through event API Compatibility

Please visit our official github account where we keep updated our code and documentation: Mailjet's Ruby GEM

Compatibility

This GEM is supported by:
- Ruby 1.8.7
- Ruby 1.9.X
- jRuby
- Rubinius
- Rails ActionMailer integration designed for Rails 3.X

Quick Install

Bundler

Add the following in your Gemfile:

 
# Gemfile
gem 'mailjet'
 

and let the bundler magic happen

 
$ bundle install
 

Rubygems

 
$ gem install mailjet
 

Setup

Api key

You need a proper account with Maijet. You can get the API key through the Maijet interface in Account/Master API key

Add the keys to an initializer:

 
# initializers/mailjet.rb
Mailjet.configure do |config|
  config.api_key = 'your-api-key'
  config.secret_key = 'your-secret-key'
  config.default_from = 'my_registered_mailjet_email@domain.com'
end
 

- domain is needed if you send emails with :mailjet's SMTP (below)
- default_from is optional if you send emails with :mailjet's SMTP (below)

Send emails with ActionMailer

As easy as:

 
# application.rb
config.action_mailer.delivery_method = :mailjet