I am trying to use the following code to send out meeting request using nodemailer. The problem I am facing is that the meeting invite is going as an attachment ics file instead of request where one can directly add. I have tried it on multiple mail client. Any pointers would be highly appreciated.
transport.sendMail({
from: 'BakBak.io <[email protected]>',
to: '[email protected]',
subject: 'Meeting',
//html: "Hi",
text: "Hola!!",
alternative: {
contentType: "text/calendar; method=REQUEST; name='meeting.ics';component=VEVENT",
contents: new Buffer(cal.toString()),
contentEncoding:"7bit",
"Content-Class":"urn:content-classes:calendarmessage"
},
headers: {
"Content-Type": "text/calendar",
//"charset":"utf-8",
"method":"REQUEST",
"component":"VEVENT",
"Content-Class":"urn:content-classes:calendarmessage"
}//,
//attachments : [{filename:'invite.ics',contents: cal.toString()}]
}, function(err, responseStatus) {
if (err) {
console.log(err);
res.render('schedule',{errors: err.message});
} else {
console.log(responseStatus.message);
res.render('schedule',{success_msg: "Successfully Created!"});
}
});
Gmail does not show meeting request and give an option to add to calendar if sender and receiver are same.
This is what worked for me:
transport.sendMail({
from: 'BakBak.io <[email protected]>',
to: '[email protected]',
subject: 'Meeting',
html: "Hiya!!",
text: "Hola!!",
alternatives: [{
contentType: "text/calendar",
content: new Buffer(ical)
}]
}, function(err, responseStatus) {
if (err) {
console.log(err);
res.render('schedule',{errors: err.message});
} else {
console.log(responseStatus.message);
res.render('schedule',{success_msg: "Successfully Created!"});
}
});