Created
March 12, 2015 07:49
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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