#!/usr/bin/env node require('dotenv').config(); const { sendMail } = require('./src/utils/email'); async function testEmail() { console.log('🧪 Testing Email Configuration'); console.log('================================'); // Check environment variables console.log('\n🔧 Environment Variables:'); console.log('NODE_ENV:', process.env.NODE_ENV || 'development'); console.log('SMTP_HOST:', process.env.SMTP_HOST || 'Not set'); console.log('SMTP_USER:', process.env.SMTP_USER || 'Not set'); console.log('SMTP_PASS:', process.env.SMTP_PASS ? '***Set***' : 'Not set'); console.log('GMAIL_USER:', process.env.GMAIL_USER || 'Not set'); console.log('GMAIL_APP_PASSWORD:', process.env.GMAIL_APP_PASSWORD ? '***Set***' : 'Not set'); console.log('SMTP_FROM:', process.env.SMTP_FROM || 'Not set'); // Test email sending console.log('\n📧 Testing Email Sending...'); const testEmail = { to: 'test@example.com', subject: 'Test Email - User Auth Service', text: 'This is a test email to verify email configuration.', html: `
This is a test email to verify email configuration for the User Auth Service.
Timestamp: ${new Date().toISOString()}
Environment: ${process.env.NODE_ENV || 'development'}
If you receive this email, your email configuration is working correctly!