bamboo v1.6.0 Bamboo.MailgunHelper 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.
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
deliverytime(email, deliverytime) View Source
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)
substitute_variables(email, variables) View Source
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" })
substitute_variables(email, key, value) View Source
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")
tag(email, tag) View Source
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")
template(email, template_name) View Source
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.
template_text(email, arg2) View Source
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)
template_version(email, version) View Source
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")