diff --git a/app/app/lib/mailer.server.ts b/app/app/lib/mailer.server.ts index 55533bd..38908d0 100644 --- a/app/app/lib/mailer.server.ts +++ b/app/app/lib/mailer.server.ts @@ -35,13 +35,20 @@ function buildTransport(smtp?: SmtpConfig | null) { const port = useShop ? Number(smtp!.port ?? 587) : Number(process.env.SMTP_PORT ?? 587); - const secure = useShop ? !!smtp!.secure : process.env.SMTP_SECURE === "true"; + const rawSecure = useShop + ? !!smtp!.secure + : process.env.SMTP_SECURE === "true"; + // Le porte standard vincolano la modalita' TLS: 465 = TLS diretto, 587 = + // STARTTLS. Spuntare "sicura" sulla 587 (errore comune) rompeva l'handshake. + // Su porte non standard vale la scelta del merchant. + const secure = port === 465 ? true : port === 587 ? false : rawSecure; const user = useShop ? smtp!.user : process.env.SMTP_USER; const pass = useShop ? smtp!.pass : process.env.SMTP_PASS; return nodemailer.createTransport({ host, port, secure, + requireTLS: port === 587, // forza STARTTLS dove e' obbligatorio auth: user ? { user, pass: pass ?? "" } : undefined, connectionTimeout: 10_000, greetingTimeout: 10_000, diff --git a/app/app/routes/app.settings.tsx b/app/app/routes/app.settings.tsx index 38e96c4..96f1397 100644 --- a/app/app/routes/app.settings.tsx +++ b/app/app/routes/app.settings.tsx @@ -439,6 +439,12 @@ export default function SettingsPage() { helpText="Dove ricevere le notifiche. Senza indirizzo l'email non parte." placeholder="ordini@tuonegozio.it" /> + {notifyEnabled && !notifyEmail.trim() ? ( + + Notifiche attive ma nessun indirizzo: al momento non ricevi + nulla. Inserisci un'email. + + ) : null}