|
|
|
@ -1,11 +1,15 @@
|
|
|
|
|
import Email from 'email-templates';
|
|
|
|
|
import nodemailer from 'nodemailer';
|
|
|
|
|
import { NotificationAgentEmail } from '../settings';
|
|
|
|
|
import { URL } from 'url';
|
|
|
|
|
import { getSettings, NotificationAgentEmail } from '../settings';
|
|
|
|
|
import { openpgpEncrypt } from './openpgpEncrypt';
|
|
|
|
|
|
|
|
|
|
class PreparedEmail extends Email {
|
|
|
|
|
public constructor(settings: NotificationAgentEmail, pgpKey?: string) {
|
|
|
|
|
const { applicationUrl } = getSettings().main;
|
|
|
|
|
|
|
|
|
|
const transport = nodemailer.createTransport({
|
|
|
|
|
name: applicationUrl ? new URL(applicationUrl).hostname : undefined,
|
|
|
|
|
host: settings.options.smtpHost,
|
|
|
|
|
port: settings.options.smtpPort,
|
|
|
|
|
secure: settings.options.secure,
|
|
|
|
|