Swoosh v0.23.0 Swoosh.Adapters.Gmail View Source

An adapter that sends email using Gmail api

For reference Gmail API docs

You don't need to set from address as google will set it for you. If you still want to include it, make sure it matches the account or it will be ignored.

Dependency

Gmail adapter requires Mail dependency to format message as RFC 2822 message.

Because Mail library removes Bcc headers, they are being added after email is rendered.

Example

# config/congig.exs
config :sample, Smaple.Mailer
  adapter: Swoosh.Adapters.Gmail,


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

Required config parameters

  • :access_token valid OAuth2 access token Required scopes:

    • gmail.compose See https://developers.google.com/oauthplayground when developing

Link to this section Summary

Functions

Delivers an email with the given config

Link to this section Functions

Delivers an email with the given config.

Callback implementation for Swoosh.Adapter.deliver/2.

Callback implementation for Swoosh.Adapter.validate_config/1.

Callback implementation for Swoosh.Adapter.validate_dependency/0.