View Source Swoosh.Adapters.SMTP (Swoosh v1.6.0)

An adapter that sends email using the SMTP protocol.

Underneath this adapter uses the gen_smtp library, add it to your mix.exs file.


# mix.exs
def deps do
   {:swoosh, "~> 1.3"},
   {:gen_smtp, "~> 1.1"}

# config/config.exs
config :sample, Sample.Mailer,
  adapter: Swoosh.Adapters.SMTP,
  relay: "",
  username: "tonystark",
  password: "ilovepepperpotts",
  ssl: true,
  tls: :always,
  auth: :always,
  port: 1025,
  dkim: [
    s: "default", d: "",
    private_key: {:pem_plain,!("priv/keys/domain.private")}
  retries: 2,
  no_mx_lookups: false

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

Link to this section Summary

Link to this section Functions

Callback implementation for Swoosh.Adapter.validate_config/1.

Callback implementation for Swoosh.Adapter.validate_dependency/0.