kshnurov / mandrill_dm

A basic Mandrill delivery method for Rails.
MIT License
46 stars 45 forks source link

Add `merge` flag and `merge_language` flag to message #14

Closed spovich closed 9 years ago

spovich commented 9 years ago

Mandrill API accepts a boolean for merge which indicates there is content in the email body that can be dynamically substituted. Also, mandrill supports two different merge_language settings (handlesbars or mailchimp).

This PR allows you to set the merge flag and the merge_language.

This PR also does a fair bit of clean up:

Having long files with methods/lists not in alpha order was making me crazy so:

spovich commented 9 years ago

@jlberglund @kshnurov if if either of you have a few minutes, I'd appreciate some :eyes: on this. There is a lot of noise in the message_spec.rb because I put things in alpha order (was making me crazy).

They use-case for this is that I want to customize links in emails for multiple recipients to include the email address of the individual who clicks the link (not waiting for webhook). merge and merge_language let me do that.

If you have a link in the body of your email like below and you specify merge is true and merge_language is handlebars:

<a href='http://my-server.com?rcpt_email={{EMAIL}}'>test link</a>

the {{EMAIL}} will be replaced with the specific recipient email address.

jlberglund commented 9 years ago

Cleanup looks good. And merging seems like a good idea. I've run into a couple of instances where it would have been helpful (along with Mandrill templates). +1

jlberglund commented 9 years ago

@spovich If you want to use a style guide, btw, feel free to reference it in the Wiki.

kshnurov commented 9 years ago

@spovich global_merge_vars and merge_vars should be added to make merge really useful. I've created an issue #17