From 96ce85de3c3925673768874f4f92ad3ed770ef85 Mon Sep 17 00:00:00 2001 From: Krish Chothani <143370415+KrishChothani@users.noreply.github.com> Date: Fri, 3 Oct 2025 10:14:18 +0530 Subject: [PATCH] Add NodeMailer Email Integration --- .../NodeMailer Email Integration/.env.sample | 4 ++ .../NodeMailer Email Integration/README.md | 35 +++++++++++++ .../NodeMailer Email Integration/sendMail.js | 49 +++++++++++++++++++ 3 files changed, 88 insertions(+) create mode 100644 Integration/NodeMailer Email Integration/.env.sample create mode 100644 Integration/NodeMailer Email Integration/README.md create mode 100644 Integration/NodeMailer Email Integration/sendMail.js diff --git a/Integration/NodeMailer Email Integration/.env.sample b/Integration/NodeMailer Email Integration/.env.sample new file mode 100644 index 0000000000..8a8adca47b --- /dev/null +++ b/Integration/NodeMailer Email Integration/.env.sample @@ -0,0 +1,4 @@ +SMTP_HOST=smtp.gmail.com +SMTP_PORT=587 +SMTP_USER=your_email@gmail.com +SMTP_PASS=your_app_password diff --git a/Integration/NodeMailer Email Integration/README.md b/Integration/NodeMailer Email Integration/README.md new file mode 100644 index 0000000000..30cc1a9348 --- /dev/null +++ b/Integration/NodeMailer Email Integration/README.md @@ -0,0 +1,35 @@ +# 📧 NodeMailer Email Integration + +This snippet demonstrates how to send emails using **NodeMailer** in a Node.js environment. +It is useful for integrating ServiceNow or custom applications with external email providers via SMTP. + +## ✨ Features +- Uses environment variables for secure configuration. +- Sends both **plain text** and **HTML** emails. +- Provides error handling and logging. +- Ready for integration in ServiceNow-related workflows or external utilities. + +## 🛠️ Setup Instructions +1. Install dependencies: + ```bash + npm install nodemailer + + +2. 🔧 Configure Environment Variables + +```bash +SMTP_HOST=smtp.gmail.com +SMTP_PORT=587 +SMTP_USER=your_email@gmail.com +SMTP_PASS=your_app_password + +3. 📧 Sending Emails with NodeMailer + +You can use the provided snippet to quickly send emails: + +```javascript +// Import the sendMail function +const { sendMail } = require("./sendMail"); + +// Send an email +sendMail("receiver@example.com", "