Is a mailer component for sending emails using SMTP. The name comes from the greek messanger of the gods.
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' } ]
end
If you aren't using hex, add the a reference to the github repo.
def deps do
[ { :hermes, github: "nurugger07/hermes" } ]
end
Ensure 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"]
Add a module to work as the messenger:
defmodule SimpleMessenger do
use Hermes.Messenger
end
Then create a message struct and call deliver:
%Hermes.Message{
from: "[email protected]",
to: "[email protected]",
subject: "Hello, World!",
body: """
Hello!
This is my first email sent through hermes.
Thanks,
Johnny
"""} |> SimpleMessenger.deliver
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.