Aspose.Email  for Node.js via .NET

Node.js API for Email Processing

Create, Manipulate or Convert email formats including MSG, EML, EMLX & MHT from within Node.js applications.


Aspose.Email for Node.js via .NET is a flexible yet powerful Email Programming API, that saves developer's time & effort to create, manipulate or convert common email message formats without worrying about the complexities of the underlying format implementation.

How to install
Simply execute npm install @aspose/email to get the latest version & try any of the following code snippets.

Dynamically Convert Message Files

Aspose.Email for Node.js via .NET is a good choice if you are looking for an API to inter-convert email files. It provides easy-to-use interfaces for the conversion process while hiding all the ugly details of the underlying format specification. All you need to do is to load the source file in Aspose.Email object model and call the Save method with appropriate parameters. It is really that simple!

Convert MSG to various formats

const ae = require('@aspose/email');

const msg= new ae.MailMessage.load("msgtemplate.msg");

// convert MSG to EML, HTML & MHTML formats"emloutput.eml", SaveOptions.defaultEml);"htmloutput.html", SaveOptions.defaultHtml);"mhtoutput.mhtml", SaveOptions.defaultMhtml)

Extensive Support for Appointment ICS Format

Aspose.Email for Node.js via .NET can be used to create appointments and save them in ICS format. The Node.js Email Library also allows to load appointments from ICS files, read or write appointment events, create an appointment as a draft and set participants status of the appointment attendees.

Create and save appointments

const ae = require('@aspose/email');

const attendees = new ae.MailAddressCollection();
attendees.add(new ae.MailAddress(""));
attendees.add(new ae.MailAddress(""));
attendees.add(new ae.MailAddress(""));

// create
const app = new ae.Calendar.Appointment("Room 112",
    new Date(2006, 6, 17, 13, 0, 0),
    new Date(2006, 6, 17, 14, 0, 0),
    new ae.MailAddress(""),

app.summary = "Release Meetting";
app.description = "Discuss for the next release";

// save as ICS
const options = new ae.Calendar.AppointmentIcsSaveOptions(); // use default ICS options"AppointmentInICSFormat_out.ics", options);

Load an appointment

const ae = require('@aspose/email');

const loadedAppointment = ae.Calendar.Appointment.load("Appointment.ics");
// Display the appointment information on screen
console.log("Summary: ", loadedAppointment.summary);
console.log("Location: ", loadedAppointment.location);
console.log("Description: ", loadedAppointment.description);
console.log("Start date::", loadedAppointment.startDate);
console.log("End date:", loadedAppointment.endDate);
console.log("Organizer: ", loadedAppointment.organizer);
console.log("Attendees: ", loadedAppointment.attendees);            

Produce & Consume Meetings with iCalendar API

Aspose.Email for Node.js via .NET provides the functionality to generate & save Outlook Calendar items in MSG and ICS formats. Not only you can create and save iCalendar objects, but also retrieve, update, send & cancel meeting requests. Moreover, using the intuitive object model it is easy to dynamically produce and consume recurrence patterns in iCalendar RFC 2445 format.

Create an Appointment Request. See details here

const ae = require('@aspose/email');

const appWhere = "location";
const appWhen = new Date(2023, 8, 17, 13, 0, 0);
const sender = new ae.MailAddress("");
const recipient = new ae.MailAddress("");
const attendees = new ae.MailAddressCollection();

const app = new ae.Calendar.Appointment(appWhere, appWhen, appWhen, sender, attendees);

const message = new ae.MailMessage(sender, recipient);
const msg = ae.Mapi.MapiMessage.fromMailMessage(message);

// Save the appointment."appointment.msg");            

Create or Manipulate PST, OST & MBOX Files

Aspose.Email for Node.js via .NET allows you to manage Outlook storage files such as PST & OST. You can perform a number of operations on existing storage files as well as create new PST files from scratch. Possible operations include folder listing, message listing, messages extraction and contacts in MSG format.

Read PST

const ae = require('@aspose/email');

const pst = ae.Storage.Pst.PersonalStorage.fromFile("outlook.pst");
const rootFolders = pst.rootFolder.getSubFolders();

for( folder of rootFolders) {
    console.log("Folder: ", folder.displayName);
    console.log("Total Items: ", folder.contentCount);
    console.log("Total Unread Items: ", folder.contentUnreadCount);
    for(msg of folder.enumerateMessages()) {
        console.log("  ", msg.subject);

Along with Outlook storage files, Aspose.Email for Node.js via .NET also supports Mbox file format. You can use Aspose.Email for Node.js via .NET to load existing Mbox files and extract message information.

Extract messages from Mbox

var ae = require('@aspose/email');

const options = new ae.Storage.Mbox.MboxLoadOptions(); // using default options
const reader = new ae.Storage.Mbox.MboxrdStorageReader("Inbox.mbox", options);
let index = 0;
//  Read all messages in a loop
for(eml of reader.enumerateMessages() ) {
    console.log("Subject: ", eml.subject);

    // save message in EML & MSG format`${index}_output.eml`, ae.SaveOptions.defaultEml);`${index}_output.msg`, ae.SaveOptions.defaultMsgUnicode);

Support and Learning Resources


Aspose.Email offers individual Email APIs for other popular development environments as listed below: