Bamboo.MailgunHelper (bamboo v2.3.0) View Source
Functions for using features specific to Mailgun (e.g. tagging, templates).
Link to this section Summary
Functions
Schedule an email to be delivered in the future.
Adds Mailgun recipient variables to the outgoing email
This behaves like Bamboo.MailgunHelper.substitute_variables/3
, but
accepts a Map
rather than a key, value pair.
When sending an email with Bamboo.MailgunHelper.template/2
you can
replace a handlebars variables using this function.
Add a tag to outgoing email to help categorize traffic based on some criteria, perhaps separate signup emails from password recovery emails or from user comments.
Send an email using a template stored in Mailgun, rather than supplying
a Bamboo.Email.text_body/2
or a Bamboo.Email.html_body/2
.
Use it if you want to have rendered template in the text part of the message in case of template sending.
Use it to send a message to specific version of a template.
Link to this section Functions
Schedule an email to be delivered in the future.
More details can be found in the Mailgun documentation
Example
one_hour_from_now =
DateTime.utc_now()
|> DateTime.add(3600)
email
|> MailgunHelper.deliverytime(one_hour_from_now)
Adds Mailgun recipient variables to the outgoing email
More details can be found in the Mailgun documentation
Example
variables = %{
"user1@example.com" => %{unique_id: "ABC123456789"},
"user2@example.com" => %{unique_id: "ZXY987654321"}
}
email
|> MailgunHelper.recipient_variables(variables)
This behaves like Bamboo.MailgunHelper.substitute_variables/3
, but
accepts a Map
rather than a key, value pair.
Example
email
|> MailgunHelper.template("password-reset-email")
|> MailgunHelper.substitute_variables(%{ "greeting" => "Hello!", "password_reset_link" => "https://example.com/123" })
When sending an email with Bamboo.MailgunHelper.template/2
you can
replace a handlebars variables using this function.
More details about templates can be found in the Templates section of the Mailgun documentation.
Example
email
|> MailgunHelper.template("password-reset-email")
|> MailgunHelper.substitute_variables("password_reset_link", "https://example.com/123")
Add a tag to outgoing email to help categorize traffic based on some criteria, perhaps separate signup emails from password recovery emails or from user comments.
More details can be found in the Mailgun documentation
Example
email
|> MailgunHelper.tag("welcome-email")
Send an email using a template stored in Mailgun, rather than supplying
a Bamboo.Email.text_body/2
or a Bamboo.Email.html_body/2
.
More details about templates can be found in the Templates section of the Mailgun documentation.
Use it if you want to have rendered template in the text part of the message in case of template sending.
More details can be found in the Mailgun documentation
Example
email
|> MailgunHelper.template_text(true)
Use it to send a message to specific version of a template.
More details can be found in the Mailgun documentation
Example
email
|> MailgunHelper.template("my-template")
|> MailgunHelper.template_version("v2")