test23

rasksha

test23

N

By NextGenCMC Expert

26 October 2025

👁️ 71
raksha

raksha

javascript
import nodemailer from "nodemailer";

export async function sendEmailNotification(subscriberEmail: string): Promise<void> {
  try {
    // Check if email is configured
    if (!process.env.ZMAIL_USER || !process.env.ZMAIL_PASS) {
      console.warn('⚠️ Email not configured - skipping notification');
      return;
    }

    // Configure Zoho SMTP
    const transporter = nodemailer.createTransport({
      host: process.env.ZMAIL_HOST || "smtp.zoho.in",
      port: Number(process.env.ZMAIL_PORT) || 465,
      secure: true,
      auth: {
        user: process.env.ZMAIL_USER,
        pass: process.env.ZMAIL_PASS,
      },
    });

    // Email content
    const mailOptions = {
      from: `"NextGenCMC Newsletter" <${process.env.ZMAIL_USER}>`,
      to: process.env.ZMAIL_TO_NOTIFY || process.env.ZMAIL_USER,
      subject: "🎉 New Newsletter Subscriber - NextGenCMC",
      html: `
        <div style="font-family:Arial,sans-serif;max-width:600px;margin:auto;padding:20px;border:1px solid #e0e0e0;border-radius:8px;background:#fafafa;">
          <h2 style="color:#0a66c2;text-align:center;">🎉 New Newsletter Subscriber!</h2>
          <p><strong>Email:</strong> <a href="mailto:${subscriberEmail}">${subscriberEmail}</a></p>
          <p><strong>Time:</strong> ${new Date().toLocaleString('en-IN', { timeZone: 'Asia/Kolkata' })}</p>
          <hr style="margin:20px 0;border:none;border-top:1px solid #ccc;" />
          <p style="font-size:12px;color:#777;text-align:center;">
            Subscribed via NextGenCMC Newsletter © ${new Date().getFullYear()}
          </p>
        </div>
      `,
    };

    const result = await transporter.sendMail(mailOptions);
    console.log('✅ Newsletter notification sent:', result.messageId);
  } catch (error) {
    console.error('❌ Failed to send newsletter notification:', error);
    throw error;
  }
}

test

table 1table 2
row 1row 2

al test

test
column

test
deascr

temiline

timmserjkk

gfgh
✅ Send email

mail2


cmc
📥

cmc

hbhbh

Share this article

Loading related posts...

NextGenCMC – Regulatory Excellence

Professional regulatory affairs expertise specializing in CMC submissions, MHRA variations, and compliance strategies.

Tags:

Cmc Regulatory

Loading comments...