Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
MSG JS
>
Tutorial
> Add attachment
The following example shows you how to create message and 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());
Need help? Ask our developers:
Name*
Email*
Message*