SMTP-Fix: IPv4 bevorzugen (Container ohne IPv6 -> Strato-Timeout) + kurze Timeouts
This commit is contained in:
1 parent
ff14edf28a
commit
decad8165f
1 file changed
+8
@@ -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 || '');
|
||||
|
||||
Reference in new issue
Block a user