[Elixir SDK]
Phoenix
Send email from Phoenix controllers and LiveView with the Elixir client.
1
Install the Elixir package
bash
{:reloop, "~> 0.1.0"}2
Send email from Phoenix
send_email.ex
1defmodule MyAppWeb.EmailController do2 use MyAppWeb, :controller3
4 def create(conn, %{"to" => to}) do5 client = Reloop.client(api_key: System.get_env("RELOOP_API_KEY"))6
7 case Reloop.Emails.send(client, %{8 from: "Acme <onboarding@yourdomain.com>",9 to: [to],10 subject: "Hello from Phoenix",11 html: "<strong>It works!</strong>"12 }) do13 {:ok, email} -> json(conn, %{id: email.id})14 {:error, reason} -> conn |> put_status(500) |> json(%{error: inspect(reason)})15 end16 end17end3
GitHub, examples, and API reference
4
Need more help?
- Need help? Contact Support.
- Chat with Reloop developers on Discord.
- Check out our changelog.
- Questions? Contact Sales.
- LLM? Read llms.txt.
Send with Phoenix.
Get an API key and ship transactional email from Phoenix using the official Elixir SDK.