diff --git a/server.js b/server.js index e5e119d..8889d4a 100644 --- a/server.js +++ b/server.js @@ -7,6 +7,11 @@ import express from 'express'; import cors from 'cors'; import rateLimit from 'express-rate-limit'; import nodemailer from 'nodemailer'; +import dns from 'node:dns'; + +// Container haben oft keine IPv6-Route. Strato (smtp.strato.de) löst sonst auf +// eine IPv6-Adresse auf -> SMTP-Verbindung läuft in den Timeout. IPv4 bevorzugen: +dns.setDefaultResultOrder('ipv4first'); const { PORT = 3000, @@ -53,6 +58,9 @@ const transporter = nodemailer.createTransport({ port: Number(SMTP_PORT), secure: String(SMTP_SECURE) === 'true', auth: SMTP_USER ? { user: SMTP_USER, pass: SMTP_PASS } : undefined, + connectionTimeout: 10000, // schnell abbrechen statt hängen + greetingTimeout: 10000, + socketTimeout: 15000, }); const isEmail = (v) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(v || '');