From 7a338188f3ce6c3aa53054afaa936aa807d65fd8 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 14 Feb 2019 11:56:23 +0100 Subject: Fix from header in contact form --- server/lib/emailer.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'server/lib/emailer.ts') diff --git a/server/lib/emailer.ts b/server/lib/emailer.ts index f384a254e..99010f473 100644 --- a/server/lib/emailer.ts +++ b/server/lib/emailer.ts @@ -361,7 +361,8 @@ class Emailer { 'PeerTube.' const emailPayload: EmailPayload = { - from: fromEmail, + fromDisplayName: fromEmail, + replyTo: fromEmail, to: [ CONFIG.ADMIN.EMAIL ], subject: '[PeerTube] Contact form submitted', text @@ -370,16 +371,21 @@ class Emailer { return JobQueue.Instance.createJob({ type: 'email', payload: emailPayload }) } - sendMail (to: string[], subject: string, text: string, from?: string) { + sendMail (options: EmailPayload) { if (!Emailer.isEnabled()) { throw new Error('Cannot send mail because SMTP is not configured.') } + const fromDisplayName = options.fromDisplayName + ? options.fromDisplayName + : CONFIG.WEBSERVER.HOST + return this.transporter.sendMail({ - from: from || CONFIG.SMTP.FROM_ADDRESS, - to: to.join(','), - subject, - text + from: `"${fromDisplayName}" <${CONFIG.SMTP.FROM_ADDRESS}>`, + replyTo: options.replyTo, + to: options.to.join(','), + subject: options.subject, + text: options.text }) } -- cgit v1.2.3