node.js - Node sendgrid ICAS/ICS invitation -
i using npm sendgrid
node sendgrid github
with have created following module:
var path = require('path'), emailtemplates = require('email-templates'), async = require("async"), mailconfig = require('../config/email.json'), templates = require('../config/emailtemplates.json'), _ = require('lodash'), sendgrid = require('sendgrid')(mailconfig.sendgridapikey), fs = require("fs"); var mymailer = {}; /** * sends email either 1 or multiple users * @param template_id (the id key of template. can found in emailtemplates.json * @param string or array * @param string * @param subject string * @param keyreplacer array of objects keys replace in template * @param files array of file objects */ mymailer.sendtemplate = function (template_id, to, from, subject, keyreplacer, section, text, files) { var email = new sendgrid.email(), templatekey = templates[template_id]; if (templatekey) { email.setsmtpapitos(to); email.subject = subject; email.from = from; email.text = text; email.html = 'gief html nu:d'; email.setfilters({ "templates": { "settings": { "enable": 1, "template_id": templatekey } } }); email.smtpapi.header.sub = preparesub(keyreplacer, section); email.smtpapi.header.section = preparesection(section); email.files = prepareattachement(files); sendgrid.send(email); } else { console.log('incorrect key'); } };
now of mails wish send invitation can accepted in calendar. have no idea how , cant seem find information on subject.
has tried sending using sendgrid ? , if can point me in right direction?
if willing upgrade newest version of node.js sendgrid client library, may find v3 /mail/send endpoint makes sending calendar invitations easier.
here example of adding content type of "text/calendar": https://github.com/sendgrid/sendgrid-nodejs/blob/master/examples/helpers/mail/example.js#l57
here documentation on new v3 /mail/send endpoint if rather use directly:
https://sendgrid.com/docs/classroom/send/v3_mail_send/index.html https://sendgrid.com/docs/api_reference/web_api_v3/mail/index.html
Comments
Post a Comment