N/email Module Methods for Email Management in NetSuite
The N/email module provides methods for sending transactional, bulk, and campaign emails within NetSuite, enhancing communication capabilities.
The N/email module in NetSuite allows developers and administrators to send various types of email messages directly from the platform. This functionality is essential not only for transactional emails but also for bulk communications and targeted campaign emails. Leveraging this module enhances user engagement and streamlines customer interactions.
What are the N/email Module Members?
The N/email module includes several methods for sending emails:
| Member Name | Return Type | Supported Script Types | Description |
|---|---|---|---|
email.send(options) | void | Client and server scripts | Sends transactional email to recipients and handles bounceback notifications. Requires Vicarious Email permission to send on behalf of others. |
email.send.promise(options) | void | Client scripts | Sends transactional email asynchronously to recipients with bounceback notifications handled. |
email.sendBulk(options) | void | Client and server scripts | Sends bulk email messages without needing bounceback notifications. |
email.sendBulk.promise(options) | void | Client scripts | Sends bulk email messages asynchronously without requiring bounceback notifications. |
email.sendCampaignEvent(options) | number | Client and server scripts | Sends a single 'on-demand' campaign email and returns a campaign response ID. |
email.sendCampaignEvent.promise(options) | number | Client and server scripts | Sends a single 'on-demand' campaign email asynchronously, returning a campaign response ID. |
Notes:
- The
sendmethod can handle up to 10 recipients simultaneously, including CC and BCC. - The total message size, including attachments, must not exceed 15MB, and individual attachments cannot exceed 10MB.
Who Can Send Emails?
To send an email on another user's behalf, the script executor must possess a role with the Vicarious Email (ADMI_VICARIOUS_EMAIL) permission. If a user lacking this permission runs the script and attempts to send an email, a Permission Violation error will occur.
Sample Code for Sending an Email
To highlight the capabilities of the N/email module, below is a sample script that demonstrates how to send an email with an attachment. Note that the valid IDs and file paths need to be used in your NetSuite account.
1/**2 * @NApiVersion 2.13 */4 5require(['N/email', 'N/record', 'N/file'], (email, record, file) => {6 const senderId = -515;7 const recipientEmail = 'notify@myCompany.com';8 let timeStamp = new Date().getUTCMilliseconds();9 10 let recipient = record.create({11 type: record.Type.CUSTOMER,12 isDynamic: true13 });14 recipient.setValue({15 fieldId: 'subsidiary',16 value: '1'17 });18 recipient.setValue({19 fieldId: 'companyname',20 value: 'Test Company' + timeStamp21 });22 recipient.setValue({23 fieldId: 'email',24 value: recipientEmail25 });26 27 let recipientId = recipient.save();28 29 let fileObj = file.load({30 id: 8831 });32 33 email.send({34 author: senderId,35 recipients: recipientId,36 subject: 'Test Email',37 body: 'This is a test email with an attachment.',38 attachments: [fileObj]39 });40});This reusable script can be adapted to fit your specific email sending needs.
Key Considerations
- Always ensure that the correct permissions are assigned before executing email scripts.
- Validate recipient information to avoid errors during email sending.
- Consider the governance units utilized when sending emails to optimize your scripting approach.
Source: This article is based on Oracle's official NetSuite documentation.
Frequently Asked Questions (4)
What permissions are required to send emails using the N/email module?
What is the maximum size for email attachments when using the N/email module?
How does the N/email module handle bounce-back notifications?
Can the N/email module send campaign emails asynchronously?
Was this article helpful?
More in Integration
- Natural Language Queries in NetSuite AI
MCP Standard Tools SuiteApp enables AI-driven data tasks in NetSuite, aligned with role permissions.
- Square Connector Integration in NetSuite 2026.1
Discover the Square Connector for seamless integration with NetSuite 2026.1, synchronizing transactions, orders, and inventory effortlessly.
- SuiteTalk Web Services Updates for NetSuite Integrations
SuiteTalk Web Services adds new Item Supply Plan support, enhancing integrations for efficient data management.
- SuiteTalk Web Services Enhancements in NetSuite
Explore the latest enhancements to SuiteTalk Web Services, improving integration and API functionalities in NetSuite.
Advertising
Reach Integration Professionals
Put your product in front of NetSuite experts who work with Integration every day.
Sponsor This Category