@aspose/email
v24.3.0
Published
A collection of components for working with email. It makes it easy to work with Outlook PST, EML, MSG and MHT files.
Downloads
37
Readme
Node.js Email API
Aspose.Email for Node.js via .NET
is a suite of flexible and easy-to-use APIs that provide the most powerful Email Programming Component available today. The Node.js Email API can manipulate, extract, and convert message files and message archives. The API is implemented as a native Node.js module, utilizing .NET AOT compilation, which allows for maximum processing speed when handling large PST files.
Aspose.Email for Node.js via .NET
also provides classes and algorithms that are useful for time-oriented recurrence patterns, or schedules. The central concepts are coherent with the iCalendar RFC (2445), so it is easy to incorporate iCalendar features into your own applications.
Supported Read & Write Email Formats
- Microsoft® Outlook®: MSG, PST, OST, OFT
- Email: EML, EMLX, MBOX
- macOS® Outlook: OLM
- iCal®: ICS
- Virtual Card: VCF
- Web: HTML, MHTML
Features
- Open or save emails in a variety of formats.
- Parse, read and save Microsoft Outlook messages and message archives.
- Comprehensive Object Model for MIME messages.
- Embed objects to email messages.
- Create emails using Mail Merge while incorporating data from different types of sources.
- Create & consume iCalendar compliant recurrence patterns.
- Verify email addresses, processing bounced messages, analyze spam via Bayesian & more.
- Read & Write Email Formats
- Microsoft Outlook: MSG, PST, OST, OFT Email: EML, EMLX, MBOX Others: ICS, HTML, MHTML
Getting Started with Aspose.Email for Node.js via .NET
Simply execute npm install @aspose/email
to get the latest version & try any of the following code snippets.
Samples
Create New Email Message
The MailMessage
class represents an email message and allows developers to create new email message. Basic email properties like From
, To
, Subject
and body can be easily attached with the newly created mail message. Similarly we can save the mail message into different formats like EML
, MSG
and MHTML
.
- Create an instance of the MailMessage class.
- Set email message basic properties.
- Specify multiple recipients
- Save mail message in different formats.
const ae = require('@aspose/email');
const eml = new ae.MailMessage();
// set basic properties
eml.from = new ae.MailAddress("[email protected]");
eml.subject = "New MailMessage created with Aspose.Email for Node.js";
eml.htmlBody = "<b>This line is in bold </b> while this is normal text";
// specify multiple recipients
eml.to.add(new ae.MailAddress("[email protected]", "Recipient 1"));
eml.to.add(new ae.MailAddress("[email protected]", "Recipient 2"));
eml.CC.add(new ae.MailAddress("[email protected]", "Recipient 3"));
eml.CC.add(new ae.MailAddress("[email protected]", "Recipient 4"));
// save in different formats
eml.save("default.eml");
eml.save("outlook_unicode.msg", ae.SaveOptions.defaultMsgUnicode)
eml.save("outlook_default.msg", ae.SaveOptions.defaultMsg)
eml.save("message.mhtml", ae.SaveOptions.defaultMhtml)
eml.save("message.html", ae.SaveOptions.defaultHtml)
Read Outlook PST File
You can load a PST file from disk or stream into an instance of the PersonalStorage class and get the information about its contents, for example folders, subfolders and messages.
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);
console.log("----------------------");
for(msg of folder.enumerateMessages()) {
console.log(" ", msg.subject);
}
}
Licensing
Evaluate Aspose.Email
You can use Aspose.Email for Node.js via .NET
free of cost for evaluation. The evaluation version provides almost all functionality of the product with certain limitations. The same evaluation version becomes licensed when you purchase a license and add a couple of lines of code to apply the license.
If you want to test Aspose.Email for Node.js via .NET
without evaluation version limitations, you can also request a 30 Day Temporary License. Please refer to How to get a Temporary License?
Evaluation Version Limitations
Evaluation version of Aspose.Email for Node.js via .NET
(without a license specified) provides full product functionality except some evaluation limitations.
- Only 50 emails can be extracted from a folder in PST file
- Only 3 attachments as well as inline images can be extracted from an MSG file
- Max number of processed attacments in CFB format is 1
- Max number of processed recipients in CFB format is 1
- Adds “Evaluation Message” in Subject during saving in CFB,EML or MSG formats
- End Date can’t be later then 31-12-2004 in GenerateOccurrences method of the recurrence pattern. This allows you to test the product meaningfully, yet impossible to use in a production application. For example, you can create a pattern such as “start on January 1, 2000 and repeat every last working day of a month” and generate occurrences for it. Occurrences after December 31, 2004 will not be generated in the evaluation mode
- Max number of ambiguous e-mail addresses and display names resolved by MS Exchange Server is 20
- Max length of data file allowed to be drag-and-dropped with FileDropPanel is 51200 bytes
- Only 1 file is extracted from given MSO stream by InlineAttachmentExtractor.EnumerateMsoPackage method
About the License
The license is a plain text XML file that contains details such as the product name, number of developers it is licensed to, subscription expiry date and so on. The file is digitally signed, so don’t modify the file. Even inadvertent addition of an extra line break into the file will invalidate it.
You need to set a license before utilizing Aspose.Email for Node.js via .NET
if you want to avoid its evaluation limitations. It is only required to set a license once per application (or process).
Apply License
The easiest way to set a license, is to put the license file to the application folder and specify the file name without its path.
// Instantiate an instance of License calss and set the license file through its path
var ae = require('@aspose/email');
const license = new ae.License();
license.setLicense("Aspose.Email.NodeJsviaNET.lic");
However, if the license is obtained from an external source (e.g., a database), you can use a Buffer:
var ae = require('@aspose/email');
const fs = require('fs');
// For testing purposes, let's simply read the license data from a file.
const data = fs.readFileSync('Aspose.Email.NodeJsviaNET.lic');
const license = new ae.License();
license.setLicense(data);