
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@independentsoft/msg
Advanced tools
This module allows you to easy create, read, update and parse Outlook message files.
###Examples
#####Create message
import * as msg from './independentsoft/msg.js';
import * as fs from 'fs';
let recipient1 = new msg.Recipient();
recipient1.addressType = "SMTP";
recipient1.displayType = msg.DisplayType.MAIL_USER;
recipient1.objectType = msg.ObjectType.MAIL_USER;
recipient1.displayName = "John@domain.com";
recipient1.emailAddress = "John@domain.com";
recipient1.recipientType = msg.RecipientType.TO;
let recipient2 = new msg.Recipient();
recipient2.addressType = "SMTP";
recipient2.displayType = msg.DisplayType.MAIL_USER;
recipient2.objectType = msg.ObjectType.MAIL_USER;
recipient2.displayName = "Mary@domain.com";
recipient2.emailAddress = "Mary@domain.com";
recipient2.recipientType = msg.RecipientType.CC;
let message = new msg.Message();
message.subject = "Test";
message.body = "Body text";
message.displayTo = "John Smith";
message.displayCc = "Mary Smith";
message.recipients.push(recipient1);
message.recipients.push(recipient2);
message.messageFlags.push(msg.MessageFlag.UNSENT);
message.storeSupportMasks.push(msg.StoreSupportMask.CREATE);
fs.writeFileSync("e:\\message.msg", message.toBytes());
#####Create HTML message
import * as msg from './independentsoft/msg.js';
import * as fs from 'fs';
let recipient1 = new msg.Recipient();
recipient1.addressType = "SMTP";
recipient1.displayType = msg.DisplayType.MAIL_USER;
recipient1.objectType = msg.ObjectType.MAIL_USER;
recipient1.displayName = "John@domain.com";
recipient1.emailAddress = "John@domain.com";
recipient1.recipientType = msg.RecipientType.TO;
let recipient2 = new msg.Recipient();
recipient2.addressType = "SMTP";
recipient2.displayType = msg.DisplayType.MAIL_USER;
recipient2.objectType = msg.ObjectType.MAIL_USER;
recipient2.displayName = "Mary@domain.com";
recipient2.emailAddress = "Mary@domain.com";
recipient2.recipientType = msg.RecipientType.CC;
const htmlBody = "<html><body><b>Hello World bold html text</b></body></html>"
const htmlBodyWithRtf = "{\\rtf1\\ansi\\ansicpg1252\\fromhtml1 \\htmlrtf0 " + htmlBody + "}"
const rtfBody = new TextEncoder().encode(htmlBodyWithRtf)
let message = new msg.Message();
message.subject = "Test";
message.body = "Body text";
message.displayTo = "John Smith";
message.displayCc = "Mary Smith";
message.recipients.push(recipient1);
message.recipients.push(recipient2);
message.bodyTtmlText = htmlBody
message.bodyRtf = rtfBody
message.messageFlags.push(msg.MessageFlag.UNSENT);
message.storeSupportMasks.push(msg.StoreSupportMask.CREATE);
fs.writeFileSync("e:\\message.msg", message.toBytes());
#####Read message
import * as msg from './independentsoft/msg.js';
import * as fs from 'fs';
const buffer = fs.readFileSync('e:\\unicode.msg');
const message = new msg.Message(buffer)
console.log("Subject: " + message.subject);
console.log("Sender name: " + message.senderName);
console.log("Sender email address: " + message.senderEmailAddress);
console.log("Received by name: " + message.receivedByName);
console.log("Received by email address: " + message.receivedByEmailAddress);
console.log("Sent time: " + message.clientSubmitTime);
console.log("Received time: " + message.messageDeliveryTime);
console.log("Display to: " + message.displayTo);
console.log("Display cc: " + message.displayCc);
console.log("Body: " + message.body);
#####Add attachment
import * as msg from './independentsoft/msg.js';
import * as fs from 'fs';
const buffer = fs.readFileSync("e:\\test.pdf");
let attachment = new msg.Attachment(buffer);
attachment.fileName = "test.pdf";
attachment.displayName = "test.pdf";
let message = new msg.Message();
message.subject = "Test";
message.body = "Body text";
message.messageFlags.push(msg.MessageFlag.UNSENT);
message.storeSupportMasks.push(msg.StoreSupportMask.CREATE);
message.attachments.push(attachment)
fs.writeFileSync("e:\\message.msg", message.toBytes());
#####Get attachments
import * as msg from './independentsoft/msg.js';
import * as fs from 'fs';
const buffer = fs.readFileSync("e:\\message.msg");
const message = new msg.Message(buffer);
for(let i=0; i < message.attachments.length; i++) {
const attachment = message.attachments[i];
fs.writeFileSync("e:\\temp\\" + attachment.longFileName, attachment.toBytes());
}
#####Create appointment
import * as msg from './independentsoft/msg.js';
import * as fs from 'fs';
let appointment = new msg.Message()
appointment.messageClass = "IPM.Appointment";
appointment.subject = "Test";
appointment.body = "Body text";
appointment.location = "My Office";
appointment.appointmentStartTime = new Date(2020,11,10,8,0,0);
appointment.appointmentEndTime = new Date(2020,11,10,10,0,0);
fs.writeFileSync("e:\\appointment.msg", appointment.toBytes());
#####Create contact
import * as msg from './independentsoft/msg.js';
import * as fs from 'fs';
let contact = new msg.Message()
contact.messageClass = "IPM.Contact";
contact.subject = "John Smith";
contact.displayNamePrefix = "Mr.";
contact.displayName = "John Smith";
contact.givenName = "John";
contact.surname = "Smith";
contact.companyName = "Independentsoft";
contact.email1Address = "john@independentsoft.com";
contact.email1DisplayAs = "John";
contact.email1DisplayName = "John";
contact.email1Type = "SMTP";
contact.businessAddressCity = "NY";
contact.businessAddressStreet = "First Street";
contact.businessAddressCountry = "USA";
contact.businessAddress = "First Street, NY, USA";
contact.businessPhone = "555-666-777";
fs.writeFileSync("e:\\contact.msg", contact.toBytes());
FAQs
Outlook .msg file module
We found that @independentsoft/msg demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.