From 3b929425166c7174b3cd14e32087e15c982cac97 Mon Sep 17 00:00:00 2001 From: Shankha Bhattacharya <48099339+iamshankha@users.noreply.github.com> Date: Wed, 8 Oct 2025 21:27:30 +0530 Subject: [PATCH 1/2] Create Email_Bounce_Alert_System.js Email Bounce Alert Script Purpose: This mail script detects bounced-back emails in the Junk module and identifies recipient addresses from the email body. When a bounce is detected, it automatically triggers a notification containing the affected email IDs and a link to the email record. Type: Email Script Trigger: Notification --- .../Email_Bounce_Alert_System.js | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Server-Side Components/Server Side/Email Bounce Alert System/Email_Bounce_Alert_System.js diff --git a/Server-Side Components/Server Side/Email Bounce Alert System/Email_Bounce_Alert_System.js b/Server-Side Components/Server Side/Email Bounce Alert System/Email_Bounce_Alert_System.js new file mode 100644 index 0000000000..ba1622cc20 --- /dev/null +++ b/Server-Side Components/Server Side/Email Bounce Alert System/Email_Bounce_Alert_System.js @@ -0,0 +1,39 @@ +// πŸ“§ Email Bounce Alert Script +// -------------------------------------------------------------- +// Purpose: +// This mail script detects bounced-back emails in the Junk module +// and identifies recipient addresses from the email body. +// +// When a bounce is detected, it automatically triggers a notification +// containing the affected email IDs and a link to the email record. +// +// Type: Email Script +// Trigger: Notification + +(function runMailScript(current, template, email, email_action, event) { + + // --- Step 1: Function to extract email addresses from email body --- + function extractEmails(html) { + // Regular expression to match email patterns + var emailPattern = /[\w\-]+@[\w\-]+/g; + + // Find all matching email addresses in the body + var emails = html.match(emailPattern); + + // Return the array of emails or an empty array if none found + return emails || []; + } + + // --- Step 2: Convert the email body into plain text --- + var body = current.body.toString().replaceAll('"', ''); + + // --- Step 3: Extract email addresses from the content --- + var extractedEmails = extractEmails(body); + + // --- Step 4: Build the notification message --- + template.print("This alert has been generated because a bounced email incident may have occurred due to possible IP blacklisting."); //example: IP blacklisting use case + template.print("
User(s) who missed the email: " + extractedEmails.join(', ')); + template.print("
Link to the bounced email record: "); + template.print('Click here'); + +})(current, template, email, email_action, event); From 7423e9133d3d4e7e35925fd495f9cda000887a5b Mon Sep 17 00:00:00 2001 From: Shankha Bhattacharya <48099339+iamshankha@users.noreply.github.com> Date: Wed, 8 Oct 2025 21:34:31 +0530 Subject: [PATCH 2/2] Create README.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit πŸ“§ Email Bounce Alert System πŸ“˜ Overview The Email Bounce Alert System automatically detects bounced-back emails in the Junk Mail module and alerts administrators or support teams about affected recipients. It helps identify communication failures quickly and ensures that important client messages aren’t missed due to IP blacklisting or delivery issues. 🧩 Problem Statement In large organizations, emails sometimes bounce back because of mail server issues, blacklisted IPs, or invalid addresses. Currently, identifying which users didn’t receive an important message requires manual checking of the Junk Email module, leading to delays in response and potential loss of critical communication. πŸ’‘ Solution This email script automates the detection and notification process. The email script is called from a Notification configured on the sys_email table. Email Script: Extracts affected recipient email addresses from the email body using RegEx pattern matching. Generates an automatic notification alert listing all affected users. Provides a direct link to the bounced email record for quick investigation. Notification settings: When to send: Record inserted or updated Inserted checkbox: Marked Condition: Mailbox is Junk AND Body is not empty Proper recipient(s) and subject line set in the notification. πŸš€ Benefits ⚑ Immediate visibility of bounced or undelivered emails. 🧠 Automated extraction of recipient information β€” no manual tracking required. πŸ“© Faster communication recovery, ensuring critical business messages reach the intended audience. πŸ”— Direct record access for faster troubleshooting and action. --- .../Email Bounce Alert System/README.md | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Server-Side Components/Server Side/Email Bounce Alert System/README.md diff --git a/Server-Side Components/Server Side/Email Bounce Alert System/README.md b/Server-Side Components/Server Side/Email Bounce Alert System/README.md new file mode 100644 index 0000000000..6ea179adc6 --- /dev/null +++ b/Server-Side Components/Server Side/Email Bounce Alert System/README.md @@ -0,0 +1,44 @@ +πŸ“§ Email Bounce Alert System +πŸ“˜ Overview + +The Email Bounce Alert System automatically detects bounced-back emails in the Junk Mail module and alerts administrators or support teams about affected recipients. It helps identify communication failures quickly and ensures that important client messages aren’t missed due to IP blacklisting or delivery issues. + +🧩 Problem Statement + +In large organizations, emails sometimes bounce back because of mail server issues, blacklisted IPs, or invalid addresses. +Currently, identifying which users didn’t receive an important message requires manual checking of the Junk Email module, leading to delays in response and potential loss of critical communication. + +πŸ’‘ Solution + +This email script automates the detection and notification process. + +The email script is called from a Notification configured on the sys_email table. + +Email Script: + +Extracts affected recipient email addresses from the email body using RegEx pattern matching. + +Generates an automatic notification alert listing all affected users. + +Provides a direct link to the bounced email record for quick investigation. + +Notification settings: + +When to send: Record inserted or updated + +Inserted checkbox: Marked + +Condition: Mailbox is Junk AND Body is not empty + +Proper recipient(s) and subject line set in the notification. + + +πŸš€ Benefits + +⚑ Immediate visibility of bounced or undelivered emails. + +🧠 Automated extraction of recipient information β€” no manual tracking required. + +πŸ“© Faster communication recovery, ensuring critical business messages reach the intended audience. + +πŸ”— Direct record access for faster troubleshooting and action.