Official Elixir SDK for the SendKit email API.
Add to your mix.exs:
def deps do
[
{:sendkit, "~> 1.0"}
]
endclient = SendKit.new("sk_your_api_key"){:ok, %{"id" => id}} =
SendKit.Emails.send(client, %{
from: "you@example.com",
to: ["recipient@example.com"],
subject: "Hello from SendKit",
html: "<h1>Welcome!</h1>"
}){:ok, %{"id" => id}} =
SendKit.Emails.send_mime(client, %{
envelope_from: "you@example.com",
envelope_to: "recipient@example.com",
raw_message: mime_string
})case SendKit.Emails.send(client, params) do
{:ok, %{"id" => id}} ->
IO.puts("Sent: #{id}")
{:error, %SendKit.Error{name: name, message: message, status_code: code}} ->
IO.puts("API error: #{name} (#{code}): #{message}")
end# Read API key from SENDKIT_API_KEY environment variable
client = SendKit.new()
# Custom base URL
client = SendKit.new("sk_...", base_url: "https://custom.api.com")