Bamboo.SMTPAdapter (Bamboo SMTP Adapter v4.2.2) View Source

Sends email using SMTP.

Use this adapter to send emails through SMTP. This adapter requires that some settings are set in the config. See the example section below.

Sensitive credentials should not be committed to source control and are best kept in environment variables. Using {:system, "ENV_NAME"} configuration is read from the named environment variable at runtime.

Example config

# In config/config.exs, or config.prod.exs, etc.
config :my_app, MyApp.Mailer,
  adapter: Bamboo.SMTPAdapter,
  server: "smtp.domain",
  hostname: "www.mydomain.com",
  port: 1025,
  username: "your.name@your.domain", # or {:system, "SMTP_USERNAME"}
  password: "pa55word", # or {:system, "SMTP_PASSWORD"}
  tls: :if_available, # can be `:always` or `:never`
  allowed_tls_versions: [:"tlsv1", :"tlsv1.1", :"tlsv1.2"],
  # or {":system", ALLOWED_TLS_VERSIONS"} w/ comma separated values (e.g. "tlsv1.1,tlsv1.2")
  tls_log_level: :error,
  tls_verify: :verify_peer, # optional, can be `:verify_peer` or `:verify_none`
  tls_cacertfile: "/somewhere/on/disk", # optional, path to the ca truststore
  tls_cacerts: "…", # optional, DER-encoded trusted certificates
  tls_depth: 3, # optional, tls certificate chain depth
  tls_verify_fun: {&:ssl_verify_hostname.verify_fun/3, check_hostname: "example.com"}, # optional, tls verification function
  ssl: false, # can be `true`,
  retries: 1,
  no_mx_lookups: false, # can be `true`
  auth: :if_available # can be `:always`. If your smtp relay requires authentication set it to `:always`.

# Define a Mailer. Maybe in lib/my_app/mailer.ex
defmodule MyApp.Mailer do
  use Bamboo.Mailer, otp_app: :my_app
end

Link to this section Summary

Link to this section Functions

Callback implementation for Bamboo.Adapter.deliver/2.