Mailjex
Elixir wrapper for the MailJet API.
Installation
-
Add
mailjexto your list of dependencies in mix.exs:
def deps do
[{:mailjex, "~> 0.1.3"}]
endthen...
mix deps.get-
Ensure
mailjexis started before your application:
def application do
[applications: [:mailjex]]
end- Add configuration to your app:
config :mailjex,
api_base: "https://api.mailjet.com/v3",
public_api_key: "<your public key>",
private_api_key: "<your private key>"
development_mode: true | false- Example usage:
iex> body = %{
...> "FromEmail": "fromemail@gmail.com",
...> "FromName": "Mailjet Pilot",
...> "Subject": "Your email flight plan!",
...> "MJ-TemplateID": "999902",
...> "MJ-TemplateLanguage": true,
...> "Vars": %{"name": "Alice"},
...> "Recipients": [%{"Email": "toemail@gmail.com"}]
...> }
iex> Mailjex.Delivery.send(body)Development Mode
When running in development or test environments you may not want to actually send emails. You can disable the sending of email and instead have the body of your request logged to the screen.
You can do this by setting development_mode: true in your configuration file for your environment.
For more information, see the Hex docs
You can read the docs here
Development Setup
If you are making changes to this codebase and want to test your code, you will need to copy the sample secret file.
cp config/secret.sample.exs config/secret.exsThen add your MailJet public and private keys.
Implementation state
Resources that are implemented so far.
- Delivery (sending emails)
- Messages
- Template
- Sender Templates and Domains
- Contact Lists
- Contact Properties
- Campaigns
- Statistics
- Parse API
- Event API
- Account Settings
- System
Areas of the codebase that can be improved.
- Testing error cases