vonwolf vonwolf - 1 year ago 587
Javascript Question

Is it possible to create a meeting request for outlook with nodeJS?

I am developing a very basic calendar with Angular and Node and I haven't found any code on this.

Workflow is the following : create an event, input the recipient's e-mail address, validate the event.
This triggers an e-mail sent to the recipient. The mail should be in the outlook meeting request format (not an attached object).

This means that when received in outlook the meeting is automatically added in the calendar.

Is this possible? If yes is it possible with only javascript on Node side?

Answer Source

For those still looking for an answer, here's how I managed to get the perfect solution for me. I used iCalToolkit to create a calendar object.

It's important to make sure all the relevant fields are set up (organizer and attendees with RSVP).

Initially I was using the Postmark API service to send my emails but this solution was only working by sending an ics.file attachment.

I switched to the Postmark SMTP service where you can embed the iCal data inside the message and for that I used nodemailer.

This is what it looks like :

        var icalToolkit = require('ical-toolkit');
        var postmark = require('postmark');
        var client = new postmark.Client('xxxxxxxKeyxxxxxxxxxxxx');
        var nodemailer = require('nodemailer');
        var smtpTransport = require('nodemailer-smtp-transport');

        //Create a iCal object
        var builder = icalToolkit.createIcsFileBuilder();
        builder.method = meeting.method;
        //Add the event data

        var icsFileContent = builder.toString();
        var smtpOptions = {
            port: 2525,
            secureConnection: true,

        var transporter = nodemailer.createTransport(smtpTransport(smtpOptions));

        var mailOptions = {
            from: 'message@domain.com',
            to: meeting.events[0].attendees[i].email,
            subject: 'Meeting to attend',
            html: "Anything here",
            text: "Anything here",
            alternatives: [{
              contentType: 'text/calendar; charset="utf-8"; method=REQUEST',
              content: icsFileContent.toString()

        //send mail with defined transport object 
        transporter.sendMail(mailOptions, function(error, info){
                console.log('Message sent: ' + info.response);  

This sends a real meeting request with the Accept, decline and Reject button.

It's really unbelievable the amount of work you need to go through for such a trivial functionality and how all of this not well documented. Hope this helps.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download