import nodemailer from 'nodemailer'; async function verifySmtp() { console.log("Verifying SMTP Connection..."); // Settings mirroring the default fallback in email.ts const host = process.env.SMTP_HOST || 'localhost'; const port = parseInt(process.env.SMTP_PORT || '1025'); console.log(`Configuration: ${host}:${port}`); const transporter = nodemailer.createTransport({ host, port, secure: false, ignoreTLS: true }); try { await transporter.verify(); console.log("✅ SMTP Connection Successful! MailHog is likely running."); const info = await transporter.sendMail({ from: '"Test" ', to: 'test@example.com', subject: 'Test Email', text: 'If you see this, email sending works.' }); console.log(`✅ Test email sent: ${info.messageId}`); process.exit(0); } catch (error) { console.error("❌ SMTP Connection Failed:", error); console.log("Make sure MailHog is running (usually 'brew install mailhog' & 'brew services start mailhog' or docker)."); process.exit(1); } } verifySmtp();