1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-06 03:50:26 +02:00

Fix from header in contact form

This commit is contained in:
Chocobozzz 2019-02-14 11:56:23 +01:00
parent b7a7e801ac
commit 4759fedc61
No known key found for this signature in database
GPG key ID: 583A612D890159BE
4 changed files with 25 additions and 9 deletions

View file

@ -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
})
}