Files
2026-07-02 16:04:26 +05:30

31 lines
846 B
JavaScript

import 'dotenv/config';
import nodemailer from 'nodemailer';
async function testEmail() {
try {
const transporter = nodemailer.createTransport({
host: process.env.EMAIL_HOST,
port: process.env.EMAIL_PORT,
secure: process.env.EMAIL_PORT == 465,
auth: {
user: process.env.EMAIL_USER,
pass: process.env.EMAIL_PASSWORD
}
});
const info = await transporter.sendMail({
from: process.env.EMAIL_FROM,
to: process.env.EMAIL_USER, // send to self
subject: "Test Email from Maskan PIM",
text: "This is a test email to verify SMTP configuration.",
html: "<b>This is a test email to verify SMTP configuration.</b>"
});
console.log("Message sent: %s", info.messageId);
} catch (error) {
console.error("Error sending email:", error);
}
}
testEmail();