-
Notifications
You must be signed in to change notification settings - Fork 341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mandrill Template Support #176
Mandrill Template Support #176
Conversation
@@ -91,8 +92,16 @@ defmodule Bamboo.MandrillAdapter do | |||
|
|||
defp convert_to_mandrill_params(email, api_key) do | |||
%{key: api_key, message: message_params(email)} | |||
|> add_template_params(email) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think of calling this maybe_put_template_params
. That way it's clear that it sometimes won't add the params
Left a couple comments. This is really cool! Thanks for submitting the PR |
14279ff
to
eb6b312
Compare
Inserts template config into the email to be picked up the adapter. Template content is required when sending a template so default the content to empty array.
If a template_name has been set on the email use the template api path instead of the regular one.
The send-template path requires template_name and template_content be at the root of the params. If no template, params are not affected.
eb6b312
to
aa6201d
Compare
@paulcsmith thanks for the awesome feedback! I've incorporated those changes and rebased. |
@john-griffin This looks fantastic! Thanks for the PR |
Hey folks, there are currently no docs anywhere that provide the snippet at the top of this issue, and if you aren't familiar with all the details of Mandrill, you can spend a bunch of time trying to figure out why the stuff you pass into |
@maxim exactly that just happened to me. Thanks for this comment 😄 |
@rootkc if you're up for it, a pull-request to improve the function's documentation would be very welcome! |
Adds the ability to use Mandrill's built in template support. This means template rendering can be fully offloaded to Mandrill. This is done by adding a template function to
MandrillHelper
that inserts template config into the private params. These params are detected when trying to deliver the email which switches over the API path and inserts params into the request.Here is an example of how it can be used below. Please note the only new public api is
Bamboo.MandrillHelper.template
the rest of the config can be done using existing functions.Tests are included and this is working against a production Mandrill account. Regular message sending via the API is unaffected by this change.