xpeditis2.0/apps/backend/test-email-ip.js
David d65cb721b5
Some checks are pending
CD Production (Hetzner k3s) / Promote Images (preprod → prod) (push) Waiting to run
CD Production (Hetzner k3s) / Deploy to k3s (xpeditis-prod) (push) Blocked by required conditions
CD Production (Hetzner k3s) / Smoke Tests (push) Blocked by required conditions
CD Production (Hetzner k3s) / Deployment Summary (push) Blocked by required conditions
CD Production (Hetzner k3s) / Notify Success (push) Blocked by required conditions
CD Production (Hetzner k3s) / Notify Failure (push) Blocked by required conditions
chore: sync full codebase from cicd branch
Aligns main with the complete application codebase (cicd branch).

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

66 lines
1.9 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* Test email with IP address directly (bypass DNS)
*/
const nodemailer = require('nodemailer');
const config = {
host: '3.209.246.195', // IP directe de smtp.mailtrap.io
port: 2525,
secure: false,
auth: {
user: '2597bd31d265eb',
pass: 'cd126234193c89',
},
connectionTimeout: 10000,
greetingTimeout: 10000,
socketTimeout: 30000,
tls: {
rejectUnauthorized: false,
servername: 'smtp.mailtrap.io', // Important pour TLS
},
};
console.log('🧪 Testing SMTP with IP address directly...');
console.log('Config:', {
...config,
auth: { user: config.auth.user, pass: '***' },
});
const transporter = nodemailer.createTransport(config);
console.log('\n1⃣ Verifying SMTP connection...');
transporter.verify()
.then(() => {
console.log('✅ SMTP connection verified!');
console.log('\n2⃣ Sending test email...');
return transporter.sendMail({
from: 'noreply@xpeditis.com',
to: 'test@example.com',
subject: 'Test Xpeditis - Envoi Direct IP',
html: '<h1>✅ Email envoyé avec succès!</h1><p>Ce test utilise l\'IP directe pour contourner le DNS.</p>',
});
})
.then((info) => {
console.log('✅ Email sent successfully!');
console.log('📧 Message ID:', info.messageId);
console.log('📬 Response:', info.response);
console.log('\n🎉 SUCCESS! Email sending works with IP directly.');
process.exit(0);
})
.catch((error) => {
console.error('\n❌ ERROR:', error.message);
console.error('Code:', error.code);
console.error('Command:', error.command);
if (error.code === 'EAUTH') {
console.error('\n⚠ Authentication failed - credentials may be invalid');
} else if (error.code === 'ETIMEDOUT' || error.code === 'ECONNREFUSED') {
console.error('\n⚠ Connection failed - firewall or network issue');
}
process.exit(1);
});