Why when I use email.send in suitelet, email is li...
# ask-stanley-ai
i
Why when I use email.send in suitelet, email is listed in the communication subtab of the invoice, but its status in Sent Email List is not sent
c
AI generated answer (using internal Slack threads):
Based on the conversations, it seems that the issue of the email status not being marked as 'sent' in the Sent Email List when using
email.send
in a Suitelet, even though it appears in the communication subtab of the invoice, could be due to several reasons. 1. Email Bouncing: If the recipient's email address is on the 'Bounced Email Address' list, the email might not be delivered, and hence, not marked as 'sent'. It might take some time for the system to report it as a bounce. You can check the 'Bounced Email Address' list in NetSuite to see if the recipient's email is there. 2. Identical Emails: If you are sending identical emails repeatedly, the system might not mark them as 'sent'. Try changing the subject or the body of the email to make it unique each time. 3. Workflow Triggering: If a workflow is being triggered by the Suitelet, and the workflow is also sending an email, it might interfere with the email status. Check the settings used in the Send Email action of the workflow. You might need to set the execution context of the workflow action to 'User Interface' so that it won't run when the Suitelet executes. 4. Suitelet Execution: If the Suitelet is not executing properly, it might not send the email. Check the Suitelet code and ensure it is executing as expected. Here is the sample code provided in the conversation:
Copy code
javascript
let pdfFile = renderer.renderAsPdf();
log.debug(“Generated PDF File”, pdfFile);

email.send({
    author: 14119,
    recipients: recipientsArr,
    subject: ‘Blanket Purchase Order’,
    body: ‘Please find the attached PDF of your blanket purchase order.’,
    attachments: [pdfFile],
    relatedRecords: {
         transactionId: Number(orderId),
     },
});
****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.840064108
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.83412385
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.833653271
Please provide your feedback on this answer.
m
Is "to be emailed" still checked? In that case, let your suitelet uncheck that box 🙂
i
"to be emailed" is not checked 😞 Thanks for the idea, do you have anything else in mind?
m
ah I misunderstood.. what is the status if not sent? has the emailed arrived?
i
Requirement: our client needs a button to send emails when they want. To cover it I created * a user event script, to button added in beforeLoad; * a client script, to call a suitelet when user click the button ; * a suitlet that sends email. There is no error in the logs, Emails appear in all relatedRecords added in email.send() but I don't receive any actual emails. Script is running in SANBOX. Stauts = "Not Sent" in Sent Email List There is nothing in "Bounced Email Addresses" list.
m
Ah Sandbox! If you go to Setup / Company / Email Preferences and the subtab "email options", you will have the answer there 🙂
i
YOU HAVE MEEEE 🙂 🙂 🙂 thank you a lot When I tested with manual emails from the same transaction I've got the email and I thought "Send Email to Logged in User = true" is working fine I really appreciate your help Have a wonderful day!
m
You too!