Skip to content

Conversation

@iamshankha
Copy link
Contributor

@iamshankha iamshankha commented Oct 8, 2025

PR Description:

replace this with your description

Pull Request Checklist

Overview

  • Put an x inside of the square brackets to check each item.
  • I have read and understood the CONTRIBUTING.md guidelines
  • My pull request has a descriptive title that accurately reflects the changes and the description has been filled in above.
  • I've included only files relevant to the changes described in the PR title and description
  • I've created a new branch in my forked repository for this contribution

Code Quality

  • My code is relevant to ServiceNow developers
  • My code snippets expand meaningfully on official ServiceNow documentation (if applicable)
  • I've disclosed use of ES2021 features (if applicable)
  • I've tested my code snippets in a ServiceNow environment (where possible)

Repository Structure Compliance

  • I've placed my code snippet(s) in one of the required top-level categories:
    • Core ServiceNow APIs/
    • Server-Side Components/
    • Client-Side Components/
    • Modern Development/
    • Integration/
    • Specialized Areas/
  • I've used appropriate sub-categories within the top-level categories
  • Each code snippet has its own folder with a descriptive name

Documentation

  • I've included a README.md file for each code snippet
  • The README.md includes:
    • Description of the code snippet functionality
    • Usage instructions or examples
    • Any prerequisites or dependencies
    • (Optional) Screenshots or diagrams if helpful

Restrictions

  • My PR does not include XML exports of ServiceNow records
  • My PR does not contain sensitive information (passwords, API keys, tokens)
  • My PR does not include changes that fall outside the described scope

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
📘 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.
@ivan-betev ivan-betev self-assigned this Oct 8, 2025
@ivan-betev
Copy link
Contributor

Looks good to me. Thank you for the contribution.

@ivan-betev ivan-betev merged commit 7758d08 into ServiceNowDevProgram:main Oct 8, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants