xpeditis2.0/apps/backend/test-email.js
David 08787c89c8
Some checks failed
Dev CI / Unit Tests (${{ matrix.app }}) (backend) (push) Blocked by required conditions
Dev CI / Unit Tests (${{ matrix.app }}) (frontend) (push) Blocked by required conditions
Dev CI / Notify Failure (push) Blocked by required conditions
Dev CI / Quality (${{ matrix.app }}) (backend) (push) Has been cancelled
Dev CI / Quality (${{ matrix.app }}) (frontend) (push) Has been cancelled
chore: sync full codebase from cicd branch
Aligns dev with the complete application codebase (cicd branch).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-04 12:56:16 +02:00

57 lines
1.3 KiB
JavaScript

/**
* 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: '<h1>Test Email</h1><p>If you see this, email sending works!</p>',
});
})
.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);
});