Skip to content

Instantly share code, notes, and snippets.

@preslavrachev
Created March 12, 2015 07:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save preslavrachev/d92e5a16696670741f78 to your computer and use it in GitHub Desktop.
Save preslavrachev/d92e5a16696670741f78 to your computer and use it in GitHub Desktop.
Keystone.js: Sending a template-based email using Mandrill from: https://gitter.im/keystonejs/keystone/archives/2015/01/15
//1. Set up your Mandrill credentials
keystone.init({
// ...
'mandrill api key': 'YOUR_API_KEY_HERE',
// ...
'emails': 'templates/emails',
});
//or alternatively, you can set the key later
keystone.set('mandrill api key', 'YOUR_API_KEY_HERE');
//2. sending an email
//Note: the setup assumes that you have a template file called
//'enquiry-notification.{TEMPLATE_EXTENSION, e.g. .hbs, .jade}'
//in '/templates/emails'
new keystone.Email('enquiry-notification').send({
subject: 'New Enquiry from Yoga Australia Website',
to: 'name@server.com',
fromName: 'From Name',
fromEmail: 'from@server.com',
// other locals for the email template also go here
}, callback);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment