diff options
author | Eddie Zaneski <eddiezane@gmail.com> | 2015-03-16 17:45:10 -0600 |
---|---|---|
committer | Eddie Zaneski <eddiezane@gmail.com> | 2015-03-16 17:45:10 -0600 |
commit | a4255995ad8991b14b680db262edb8aeb56e0021 (patch) | |
tree | e3d71d49a4bb7e164a88fe7c1f23b6d19ec9e862 | |
parent | 76c97be0f77c732d882bf8d35c916880e6963368 (diff) | |
download | sendgrid-nodejs-a4255995ad8991b14b680db262edb8aeb56e0021.zip sendgrid-nodejs-a4255995ad8991b14b680db262edb8aeb56e0021.tar.gz sendgrid-nodejs-a4255995ad8991b14b680db262edb8aeb56e0021.tar.bz2 |
Add template example
-rw-r--r-- | README.md | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -419,6 +419,32 @@ email.addFile({ email.addHtml('<div>Our logo:<img src="cid:the_logo"></div>'); ``` +## Templates +You can easily use SendGrid's [template engine](https://sendgrid.com/docs/User_Guide/Apps/template_engine.html). + +```javascript +var email = new sendgrid.Email(); +email.addTo('example@domain.com'); +email.subject = "Send with templates app"; +email.from = 'from@example.com'; +email.text = 'Hi there!'; +email.html = '<h1>Hi there!</h1>'; + +// add filter settings one at a time +email.addFilter('templates', 'enable', 1); +email.addFilter('templates', 'template_id', '09c6ab89-9157-4710-8ca4-db7927c631d6'); + +// or set a filter using an object literal. +email.setFilters({ + 'templates': { + 'settings': { + 'enable': 1, + 'template_id' : '09c6ab89-9157-4710-8ca4-db7927c631d6', + } + } +}); +``` + ## Options ### Changing URL |