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

# Send Email from Elixir with the turboSMTP Swoosh Adapter

> Configure Swoosh.Adapters.TurboSMTP to send email from Elixir and Phoenix apps through the turboSMTP HTTP API, with Global or EU infrastructure.

**Status: Available from Swoosh 1.28.0.** `Swoosh.Adapters.TurboSMTP` sends email and attachments through the turboSMTP HTTP API. It supports Global and EU endpoints, provider options, and automatic inline-CID qualification. See the [published package](https://hex.pm/packages/swoosh/1.28.0).

## Install

Add `{:swoosh, "~> 1.28"}` to your Mix dependencies and run `mix deps.get`. Configure an [API client supported by Swoosh](https://hexdocs.pm/swoosh/Swoosh.html#module-installation), such as Req, Finch, or Hackney.

## Configure the mailer

Add the adapter to your mailer config and load your [Consumer Key and Consumer Secret](/docs/get-started/api-keys.md) from environment variables.

```elixir Global theme={"system"}
config :sample, Sample.Mailer,
  adapter: Swoosh.Adapters.TurboSMTP,
  consumer_key: System.fetch_env!("TURBOSMTP_CONSUMER_KEY"),
  consumer_secret: System.fetch_env!("TURBOSMTP_CONSUMER_SECRET")
```

```elixir EU theme={"system"}
config :sample, Sample.Mailer,
  adapter: Swoosh.Adapters.TurboSMTP,
  consumer_key: System.fetch_env!("TURBOSMTP_CONSUMER_KEY"),
  consumer_secret: System.fetch_env!("TURBOSMTP_CONSUMER_SECRET"),
  base_url: "https://api.eu.turbo-smtp.com/api/v2"
```

Place the chosen configuration in `config/runtime.exs`.

The default Global base URL is `https://api.turbo-smtp.com/api/v2`. Define your mailer if you do not already have one:

```elixir lib/sample/mailer.ex theme={"system"}
defmodule Sample.Mailer do
  use Swoosh.Mailer, otp_app: :sample
end
```

> [!TIP]
>
> Set `base_url` to `https://api.eu.turbo-smtp.com/api/v2` to send through turboSMTP's European servers. See [GDPR and data residency](/docs/api-reference/base-urls.md#gdpr-and-data-residency).

## Send the first message

```elixir theme={"system"}
import Swoosh.Email

new()
|> from("noreply@your-domain.example")
|> to("developer@example.com")
|> subject("Hello from Elixir")
|> text_body("The TurboSMTP adapter is working.")
|> Sample.Mailer.deliver()
```

## Resources

> [card] [Adapter Documentation](https://hexdocs.pm/swoosh/Swoosh.Adapters.TurboSMTP.html)
>
> Full reference for `Swoosh.Adapters.TurboSMTP` on HexDocs.

> [card] [Merged Pull Request](https://github.com/swoosh/swoosh/pull/1190)
>
> The Swoosh pull request that added the turboSMTP adapter.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.