How it works
Bring Mailtrap’s powerful email capabilities to your Elixir application with the official SDK. Send emails and capture all test messages in a secure sandbox.

Configure
Step 1: Create a Mailtrap account and verify your domain.
Step 2: Install Mailtrap by adding the SDK to your mix.exs dependencies, as shown below ⬇️.
def deps do
[
{:mailtrap, "~> 1.0"}
]
end
Then run mix deps.get.
Step 3: Send emails, below you’ll find a minimal usage example.
client = Mailtrap.Sending.client("PASTE TOKEN HERE")
email = (%Mailtrap.Email{}
|> Mailtrap.Email.put_from({"From name", "from@example.com"})
|> Mailtrap.Email.put_to({"Recepient", "recepient@example.com"})
|> Mailtrap.Email.put_subject("Hi there")
|> Mailtrap.Email.put_text("General Kenobi"))
Mailtrap.Sending.send(client, email)
Supported functionality
- Email sending
- Email sandbox