Hermes - An Elixir Mailer
Is a mailer component for sending emails using SMTP. The name comes from the greek messanger of the gods.
Using
Hermes is simple to add to any project. If you are using the hex package manager, just add the following to your mix file:
def deps do
[ { :hermes, '~> 0.1.0' } ]
endIf you aren’t using hex, add the a reference to the github repo.
def deps do
[ { :hermes, github: "nurugger07/hermes" } ]
endEnsure that Hermes is started in the your mix file:
def application do
[applications: [:hermes]]
end
Then run mix deps.get in the shell to fetch and compile the dependencies. Next setup the config. There are default values but you most likely will need to add your own settings:
config :hermes,
[domain: "your-smtp-server",
username: "your-username",
password: "your-password"]
Simple Example
Add a module to work as the messenger:
defmodule SimpleMessenger do
use Hermes.Messenger
endThen create a message struct and call deliver:
%Hermes.Message{
from: "johnny+from@example.com",
to: "johnny+to@example.com",
subject: "Hello, World!",
body: """
Hello!
This is my first email sent through hermes.
Thanks,
Johnny
"""} |> SimpleMessenger.deliverNext Steps
This library is starting out but has the basic building blocks to send emails over SMTP. More features to come soon! If you are interested in contributing, please feel welcome to submit a pull request.