The N/email module lets SuiteScript send emails programmatically β from simple notifications to bulk campaigns with attachments and record associations.
Sending a Simple Email
define(["N/email"], (email) => {
email.send({
author: 12345,
recipients: ["user@company.com"],
subject: "Order Confirmed",
body: "Your order has been confirmed.",
relatedRecords: { transactionId: 67890 }
});
return {};
});
Sending with Attachments
const pdfFile = render.transaction({ entityId: 123, printMode: render.PrintMode.PDF });
email.send({
author: employeeId,
recipients: [customerId],
subject: "Your Invoice",
body: "Please find your invoice attached.",
attachments: [pdfFile]
});
Key Methods
| Method | Description |
|---|---|
email.send(options) | Send an immediate email |
email.sendBulk(options) | Queue bulk emails for delivery |
email.sendCampaignEvent(options) | Send a marketing campaign email |