aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/emailer.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-02-14 11:56:23 +0100
committerChocobozzz <me@florianbigard.com>2019-02-15 09:43:38 +0100
commit4759fedc6112cdb0b68b8550677c05a3b1ed62bd (patch)
tree4437aebdb12b7d359b5fa60bd0c5064456495d2e /server/lib/emailer.ts
parentb7a7e801acb7cee7a7e0ce572240642daf32a128 (diff)
downloadPeerTube-4759fedc6112cdb0b68b8550677c05a3b1ed62bd.tar.gz
PeerTube-4759fedc6112cdb0b68b8550677c05a3b1ed62bd.tar.zst
PeerTube-4759fedc6112cdb0b68b8550677c05a3b1ed62bd.zip
Fix from header in contact form
Diffstat (limited to 'server/lib/emailer.ts')
-rw-r--r--server/lib/emailer.ts18
1 files changed, 12 insertions, 6 deletions
diff --git a/server/lib/emailer.ts b/server/lib/emailer.ts
index 672414cc0..cbe384061 100644
--- a/server/lib/emailer.ts
+++ b/server/lib/emailer.ts
@@ -361,7 +361,8 @@ class Emailer {
361 'PeerTube.' 361 'PeerTube.'
362 362
363 const emailPayload: EmailPayload = { 363 const emailPayload: EmailPayload = {
364 from: fromEmail, 364 fromDisplayName: fromEmail,
365 replyTo: fromEmail,
365 to: [ CONFIG.ADMIN.EMAIL ], 366 to: [ CONFIG.ADMIN.EMAIL ],
366 subject: '[PeerTube] Contact form submitted', 367 subject: '[PeerTube] Contact form submitted',
367 text 368 text
@@ -370,16 +371,21 @@ class Emailer {
370 return JobQueue.Instance.createJob({ type: 'email', payload: emailPayload }) 371 return JobQueue.Instance.createJob({ type: 'email', payload: emailPayload })
371 } 372 }
372 373
373 sendMail (to: string[], subject: string, text: string, from?: string) { 374 sendMail (options: EmailPayload) {
374 if (!Emailer.isEnabled()) { 375 if (!Emailer.isEnabled()) {
375 throw new Error('Cannot send mail because SMTP is not configured.') 376 throw new Error('Cannot send mail because SMTP is not configured.')
376 } 377 }
377 378
379 const fromDisplayName = options.fromDisplayName
380 ? options.fromDisplayName
381 : CONFIG.WEBSERVER.HOST
382
378 return this.transporter.sendMail({ 383 return this.transporter.sendMail({
379 from: from || CONFIG.SMTP.FROM_ADDRESS, 384 from: `"${fromDisplayName}" <${CONFIG.SMTP.FROM_ADDRESS}>`,
380 to: to.join(','), 385 replyTo: options.replyTo,
381 subject, 386 to: options.to.join(','),
382 text 387 subject: options.subject,
388 text: options.text
383 }) 389 })
384 } 390 }
385 391