/** * Simple email test script for Mailtrap * Usage: node test-email.js */ const nodemailer = require('nodemailer'); const config = { host: 'smtp.mailtrap.io', port: 2525, secure: false, auth: { user: '2597bd31d265eb', pass: 'cd126234193c89', }, connectionTimeout: 10000, greetingTimeout: 10000, socketTimeout: 30000, tls: { rejectUnauthorized: false, }, dnsTimeout: 10000, }; console.log('Creating transporter with config:', { ...config, auth: { user: config.auth.user, pass: '***' }, }); const transporter = nodemailer.createTransport(config); console.log('\nVerifying SMTP connection...'); transporter.verify() .then(() => { console.log('✅ SMTP connection verified successfully!'); console.log('\nSending test email...'); return transporter.sendMail({ from: 'noreply@xpeditis.com', to: 'test@example.com', subject: 'Test Email from Xpeditis', html: '
If you see this, email sending works!
', }); }) .then((info) => { console.log('✅ Email sent successfully!'); console.log('Message ID:', info.messageId); console.log('Response:', info.response); process.exit(0); }) .catch((error) => { console.error('❌ Error:', error.message); console.error('Full error:', error); process.exit(1); });