diff --git a/server/config.js b/server/config.js index fee536c..9763869 100644 --- a/server/config.js +++ b/server/config.js @@ -141,6 +141,8 @@ export const config = { user: process.env.SMTP_USERNAME || '', pass: process.env.SMTP_PASSWORD || '', from: process.env.SMTP_FROM || process.env.SMTP_USERNAME || '', + // Antworten auf Kundenmails landen hier statt im Versandpostfach (noreply@) + replyTo: process.env.SMTP_REPLY_TO || '', }, chatNotify: { diff --git a/server/services/mailer.js b/server/services/mailer.js index 0445dce..41a219c 100644 --- a/server/services/mailer.js +++ b/server/services/mailer.js @@ -10,6 +10,8 @@ function getTransporter() { host: config.smtp.host, port: config.smtp.port, secure: config.smtp.secure, + // Port 587: ohne STARTTLS nicht senden (Hetzner erlaubt die Anmeldung auch unverschluesselt) + requireTLS: !config.smtp.secure, auth: { user: config.smtp.user, pass: config.smtp.pass }, }) } @@ -37,7 +39,7 @@ export async function sendChatNotification(customer, text) { const name = customer.name || customer.email || 'Kunde' await mailer.sendMail({ - from: `"Webklar Kundenportal" <${config.smtp.from}>`, + from: `"WEBklar Kundenbereich" <${config.smtp.from}>`, to: config.chatNotify.emails.join(', '), subject: `Neue Portalnachricht von ${name}`, text: [ @@ -65,7 +67,7 @@ export async function sendAdminNotice(subject, lines) { const mailer = getTransporter() if (!mailer || !config.chatNotify.emails.length) return { sent: false, reason: 'nicht konfiguriert' } await mailer.sendMail({ - from: `"Webklar Kundenportal" <${config.smtp.from}>`, + from: `"WEBklar Kundenbereich" <${config.smtp.from}>`, to: config.chatNotify.emails.join(', '), subject: `[Abo] ${subject}`, text: lines.join('\n'), @@ -86,7 +88,8 @@ export async function sendCustomerMail(to, subject, lines, attachments = []) { const mailer = getTransporter() if (!mailer) throw new Error('SMTP nicht konfiguriert') return mailer.sendMail({ - from: `"Webklar" <${config.smtp.from}>`, + from: `"WEBklar" <${config.smtp.from}>`, + replyTo: config.smtp.replyTo || undefined, to, bcc: config.chatNotify.emails.join(', ') || undefined, subject,