> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apollodeploy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Send emails with Elixir

> Send a transactional email with the official Apollo Signal Elixir SDK

The Elixir SDK uses Req and sends to `https://api.signal.apollodeploy.com` by default.

Before you start, [create an API key](/signal/create-an-api-key) with **Emails: Send** permission
and [verify the From domain](/signal/add-a-domain).

<Steps>
  <Step title="Install the SDK">
    Add the package to `mix.exs`:

    ```elixir theme={"dark"}
    defp deps do
      [
        {:apollo_signal, "~> 4.0"}
      ]
    end
    ```

    Then run `mix deps.get`.
  </Step>

  <Step title="Store your API key">
    Set `SIGNAL_API_KEY` in the server environment or runtime secret manager.
  </Step>

  <Step title="Send an email">
    ```elixir theme={"dark"}
    client = ApolloSignal.new(
      default_headers: %{
        "Authorization" => "Bearer #{System.fetch_env!("SIGNAL_API_KEY")}"
      }
    )

    request = %ApolloSignal.Types.SendEmailRequest{
      from: "auth@mail.company.com",
      to: ["alex@example.com"],
      subject: "Reset your password",
      text: "Use the secure link in your account to choose a new password."
    }

    {:ok, email, _metadata} = ApolloSignal.Client.send_email(client, request)
    IO.puts(email.id)
    ```
  </Step>
</Steps>

<Note>
  Successful JSON operations return `{:ok, value, metadata}`. Handle
  `{:error, %ApolloSignal.Errors{}}` in production instead of pattern matching only the success case.
</Note>

<CardGroup cols={2}>
  <Card title="All SDKs" icon="code" href="/signal/send-with/sdk-overview">
    Compare every supported language and framework.
  </Card>

  <Card title="Manage emails" icon="envelope" href="/signal/dashboard/emails/introduction">
    Follow message states and delivery timelines.
  </Card>
</CardGroup>
