When a system-generated email to multiple recipients cannot be delivered to one or more of the recipients, NetSuite reports a sent email status of “Not Sent” which is inaccurate and confusing. To find out the failed recipients, you’ll need to drill down into the detail view from the Sent Email List or run a SuiteQL query (sent email saved searches do not expose this information).
NetSuite supports sending emails in a couple of different ways: Saved searches can be configured to send out scheduled emails, users can manually send out emails using NetSuite’s mail merge functionality (typically under the “Communications” tab of a record), workflows can be designed to send out emails, the
N/email module can be used to send emails via script, etc.
In all these cases, NetSuite exposes a log of sent emails under
Setup >> Company >> Sent Email List. This information is useful, especially for monitoring failed email deliveries.
Detective Control for Failed Emails
When an email is sent from NetSuite, an email entry is usually attached under the associated record/entity. It is important to understand that those entries only indicate that an email was initiated; it does not tell us if the email was actually sent successfully.
As such, we need a way to monitor the delivery status of emails. Such a control is detective in nature as it occurs after the fact. Since the Sent Email List is searchable, it is best practice to set up a detective control saved search that flags any unsent emails based on the “Status” field and to periodically review them. As a best practice, I recommend scheduling the search to run at least daily and report issues from the past day so that you are on top of your game.
While the above search will notify us of failures, it does not tell us why the failure occurred. The Sent Email SuiteAnalytics workbook provides more information like the message headers, signatures, and a failure reason field. This additional data often helps us to determine the cause of the delivery failure.
While the control process described above is typically sufficient to diagnose email delivery failures, when there are multiple recipients, I observed that the status is “unsent” even if the email was successfully sent to some of the target recipients! This creates confusion as our initial assumption is that none of the recipients received the email although, in fact, it could be partially successful. Ideally, we would expect a status that indicates partial delivery in such cases. However, NetSuite only classifies emails as “Sent” or “Unsent”.
Additionally, the failure reason in the Sent Email workbook just lists all the recipients which is not really helpful:
When investigating a failed email issue recently, I discovered three ways to find out which recipients failed.
Option 1: Isolating Failed Recipients via the Sent Email List
The starting point is to find the target email in the Sent Email List. If necessary, you can create a custom view of the Sent Email List and add filters to help with that. In my case, my detective control saved search includes the unique message ID which I used to filter the list:
Once you find the email, click on the row number (“#”) to open a detail view. This view contains a list of all the recipients, their individual delivery statuses, and a failure reason. In my case, the villain was clear – the last email address had issues:
Option 2: Isolating Failed Recipients via the Sent Email Workbook
By exposing the Message ID field in the Sent Email SuiteAnalytics workbook, can simply click through to open the detailed email view:
Option 3: Isolating Failed Email Recipients Using SuiteQL
You can run a SuiteQL query like the one below to capture the target information. The SuiteQL data model exposes a SentEmailRecipient status table that we join to get the status per recipient.
SELECT SentDate, Subject, FailureReason, SentEmail.Status AS EmailStatus, Recipient.Recipient, Recipient.Status, MessageId FROM SentEmail LEFT JOIN SentEmailRecipient AS Recipient ON (Recipient.ID = SentEmail.Key) WHERE SentEmail.Status = 'NOT_SENT' AND SentEmail.MessageId LIKE 'Your_ID_goes_here'
Surprisingly, the failure reason field appears to be blank. SuiteQL is relatively new and the data model continues to get refined so we hope that this is a glitch that will be fixed in the future. Also, we hope that the day will come when, like saved searches, we can create scheduled emails from SuiteQL queries like this one. In the meantime, it is easy to create a script that executes the query on a schedule, if desired.
Thanks to co-contributor, Chidi Okwudire, for highlighting and investigating the SuiteQL option.
Emails remain an important yet somewhat unreliable means of communication. I hope that the tips I shared with you in this article will help you keep tabs on emails sent out of your NetSuite environment. Be sure to configure your unsent emails detective control saved search if you’ve not already done so.
NetSuite Insights is on a mission to raise the standards around NetSuite practices, one insight at a time. If that resonates with you, check out how you can become an author/collaborator here.
Also, consider subscribing to our no-nonsense email list to get these insights delivered to your inbox as soon as they’re published. Sometimes, ignorance is a choice. Choose wisely!