# `Swoosh.Adapters.Mailpit`
[🔗](https://github.com/swoosh/swoosh/blob/v1.26.2/lib/swoosh/adapters/mailpit.ex#L1)

An adapter that sends email to a self-hosted Mailpit server via its HTTP API.

For reference: [Mailpit API docs](https://mailpit.axllent.org/docs/api-v1/)

**This adapter requires an API Client.** Swoosh comes with Hackney, Finch and Req out of the box.
See the [installation section](https://hexdocs.pm/swoosh/Swoosh.html#module-installation)
for details.

## Example

    # config/config.exs
    config :sample, Sample.Mailer,
      adapter: Swoosh.Adapters.Mailpit,
      base_url: "https://mailpit.example.com",
      api_key: "YnJ...0Rw=="  # optional, for Basic Auth

    # lib/sample/mailer.ex
    defmodule Sample.Mailer do
      use Swoosh.Mailer, otp_app: :sample
    end

## Using with provider options

    import Swoosh.Email

    new()
    |> from({"Raife Hastings", "raife@example.com"})
    |> to({"Jed Haverford", "jed@example.com"})
    |> reply_to("raife.hastings@example.com")
    |> cc("eliza@example.com")
    |> cc({"Jules Landry", "jules@example.com"})
    |> bcc("james.reece@example.com")
    |> bcc({"Ben Edwards", "ben@example.com"})
    |> subject("Hello there")
    |> html_body("<h1>Hello</h1>")
    |> text_body("Hello")
    |> put_provider_option(:tags, ["welcome", "transactional"])

## Provider Options

Supported provider options are the following:

#### Inserted into request body

  * `:tags` (list of strings) - Mailpit tags

# `deliver`

# `validate_config`

# `validate_dependency`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
