Add option to specify mail providers which are not supported

This commit is contained in:
Jonas Lochmann
2019-09-15 11:35:00 +02:00
parent a7533b7864
commit 5987583ca3
3 changed files with 34 additions and 0 deletions
+8
View File
@@ -19,6 +19,7 @@ import * as Email from 'email-templates'
import { join } from 'path'
const mailimprint = process.env.MAIL_IMPRINT || 'not defined'
const mailServerBlacklist = (process.env.MAIL_SERVER_BLACKLIST || '').split(',').filter((item) => !!item)
const email = new Email({
message: {
@@ -81,3 +82,10 @@ export const sendUninstallWarningMail = async ({ receiver, deviceName }: {
}
})
}
export function isMailServerBlacklisted(mail: string) {
const parts = mail.split('@')
const domain = parts[parts.length - 1]
return mailServerBlacklist.indexOf(domain.toLowerCase()) !== -1
}