View Source Swoosh.Adapters.SMTP2GO (Swoosh v1.8.1)
An adapter that sends email using the SMTP2GO API.
For reference: SMTP2GO API docs
example
Example
# config/config.exs
config :sample, Sample.Mailer,
adapter: Swoosh.Adapters.SMTP2GO,
api_key: "my-api-key"
# lib/sample/mailer.ex
defmodule Sample.Mailer do
use Swoosh.Mailer, otp_app: :sample
end
usage
Usage
import Swoosh.Email
new()
|> from({"Tony", "ironman@example.com"})
|> to({"Thanos", "thanos@example.com"})
|> reply_to("avengers@example.com")
|> cc("hulk@example.com")
|> bcc({"Steve Rogers", "steve.rogers@example.com"})
|> subject("I'm Ironman")
|> html_body("<h1>Hello</h1>")
|> text_body("Hello")
with template:
import Swoosh.Email
new()
|> from({"Tony", "ironman@example.com"})
|> to({"Thanos", "thanos@example.com"})
|> subject("I'm Ironman")
|> put_provider_option(:template_id, "123456")
|> put_provider_option(:template_data, %{"var1" => "value1"})
Link to this section Summary
Functions
Callback implementation for Swoosh.Adapter.validate_config/1
.
Callback implementation for Swoosh.Adapter.validate_dependency/0
.
Link to this section Functions
Callback implementation for Swoosh.Adapter.validate_config/1
.
Callback implementation for Swoosh.Adapter.validate_dependency/0
.