Bamboo GmailAdapter v0.2.0 Bamboo.GmailAdapter View Source
Sends email using the Gmail API with OAuth2 authentication
There are a few preconditions that must be met before this adapter can be used to send email:
- Admin access to a GSuite account
- Implement server-side authorization
- Grant the service account domain-wide authority
- Authorize API client with required scopes
Some application settings must be configured. See the example section below.
Configuration
Setting | Description | Required? |
---|---|---|
adapter | Bamboo adapter in use (Bamboo.GmailAdapter ). | Yes |
sub | Email address the service account is impersonating (address the email is sent from). If impersonation is not needed, then nil (it is likely needed). | Yes |
sandbox | Development mode that does not send email. Details of the API call are instead output to the elixir console. | No |
json | Google auth crendentials must be provided in JSON format to the :goth app. These are generated in the Google Developers Console. | Yes |
Note:
Secrets such as the service account sub, and the auth credentials should not be commited to version control.
Instead, pass in via environment variables using a tuple:
{:system, "SUB_ADDRESS"}
Or read in from a file:
"creds.json" |> File.read!
Example Config
config :app_name, GmailAdapterTestWeb.Mailer,
adapter: Bamboo.GmailAdapter,
sub: {:system, "SUB_ADDRESS"},
sandbox: false
# Google auth credentials must be provided to the `goth` app
config :goth, json: {:system, "GCP_CREDENTIALS"}
Link to this section Summary
Functions
Callback implementation for Bamboo.Adapter.deliver/2
.
Callback implementation for Bamboo.Adapter.handle_config/1
.
Callback implementation for Bamboo.Adapter.supports_attachments?/0
.
Link to this section Functions
Callback implementation for Bamboo.Adapter.deliver/2
.
Callback implementation for Bamboo.Adapter.handle_config/1
.
Callback implementation for Bamboo.Adapter.supports_attachments?/0
.