View Source Swoosh.Adapters.SocketLabs (Swoosh v1.16.3)

An adapter that sends email using the SocketLabs Injection API.

For reference: SocketLabs API docs

This adapter requires an API Client. Swoosh comes with Hackney, Finch and Req out of the box. See the installation section for details.

Example

# config/config.exs
config :sample, Sample.Mailer
  adapter: Swoosh.Adapters.SocketLabs,
  server_id: "",
  api_key: ""

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

Using with provider options

import Swoosh.Email

new()
|> from({"Sisu", "sisu@example.com"})
|> to("raya@example.com")
|> put_provider_option(:api_template, "12345")
|> put_provider_option(:charset, "12345")
|> put_provider_option(:mailing_id, "12345")
|> put_provider_option(:message_id, "12345")
|> put_provider_option(:merge_data, %{
  "PerMessage" => %{
    "per_message1" => "value1",
    "per_message2" => "value2"
  },
  "Global" => %{
    "global1" => "value1",
    "global2" => "value2"
  }
})

Provider Options

  • :api_template (string) - ApiTemplate, identifier for a content in the Email Content Manager

  • :charset (string) - Charset, character set used when creating the email message and default to UTF8

  • :mailing_id (string) - special header used to track batches of email messages

  • :message_id (string) - special header used to track individual message

  • :merge_data (map) - data storage for inline Merge feature

Summary

Functions

Link to this function

deliver(email, config \\ [])

View Source

Callback implementation for Swoosh.Adapter.deliver/2.

Callback implementation for Swoosh.Adapter.validate_config/1.

Callback implementation for Swoosh.Adapter.validate_dependency/0.