keystonejs/keystone — pull request #686 by ignlg (2014-10-28 17:32:19+00:00)
Title: Email: Mandrill templates and render support.

Added support to send emails via Mandrill templates. New constructor options:
* `options.templateMandrillName`: Mandrill template name.
* `options.templateForceHtml`: Allows hybrid method that uses a Mandrill template but sends html too.

With a new method to render them locally: `renderMandrill`.

Added support for `globalMergeVariables` (object that is converted to Mandrill's format, see below) and `global_merge_variables`.

Added support for custom `merge_variables` as a recipient's attribute `vars`, that is flattened and converted from an object to the Mandrill's format (via `objToMandrillVars` function):
```
{ foo: 'bar', da: 'fus', hey: { ho: 'lets go' } }
=>
[{ name: 'foo', content: 'bar' }, { name: 'da', content: 'fus' }, { name: 'hey_ho', content: 'lets go' }]
```

*Note:*
There's no specific test for emails so I've tested it with my project tests and it works.
There's no documentation about the email lib but I don't have enough time to write a new section right now :(