This topic contains 4 replies, has 0 voices, and was last updated by pcutler 6 years, 11 months ago.
-
AuthorPosts
-
November 9, 2017 at 6:36 am #18155
mbursteinI have a Suitelet that sends an email using the function below after a record is created (SuiteScript 2.0 N/email module as email). Originally, I was testing the suitelet internally and it worked fine. However, once I changed it to external, I stopped receiving the email. There are no errors and the debugging statements I added weren’t much help.
I then tried offloading the email to a User Event script, which runs off the created record. It uses the exact same code to send the email after the Suitelet creates the record. The User Event script has the same issue if the runtime.executionContext is “Suitelet”, but if I create the record in the UI the email sends fine.
THEN I tried adding the relatedRecords option to the function to see if the message could be attached to the record. I created the record with the Suitelet, the email is attached to the record, BUT it still doesn’t send the email.
It seems like there is some context issue that prevents the email from being sent? Does anyone have any insight?
Code:
function sendEmail(address) {
try {
email.send({
author: -5,
recipients: address,
subject: ‘Suitelet Email’,
body: ‘This is from a suitelet…etc’,
});
}
catch (e) {
log.error({
title: ‘Problem Sending Email to: ‘ + address,
details: e
});
}
}
This is a cached copy. Click here to see the original post. -
November 27, 2017 at 1:53 pm #18156
TheUsualSuspectI think I was unable to send emails from a map reduce context in the map/reduce stages last time I checked. There may be some contexts it won’t send emails from?
-
November 27, 2017 at 2:10 pm #18157
MChammaTXIf you are testing this in sandbox external may suppress the emails since there is no login context. If it is on prod then it should work.
-
November 27, 2017 at 3:58 pm #18158
mbursteinI’m aware of the Sandbox email restriction. I was testing this in a developer account, which to my understanding, should work like a production account?
I guess the question is:
Can I send an email from an external Suitelet with Suitescript 2.0?
The email “To” is pulling an employee email address, if that matters.
-
November 28, 2017 at 10:49 am #18159
pcutlerOriginally posted by mburstein
View Post
I’m aware of the Sandbox email restriction. I was testing this in a developer account, which to my understanding, should work like a production account?
I guess the question is:
Can I send an email from an external Suitelet with Suitescript 2.0?
The email “To” is pulling an employee email address, if that matters.
Developer accounts behave similarly to sandbox accounts in terms of capturing and redirecting emails.
-
AuthorPosts
You must be logged in to reply to this topic.