You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1014 B
39 lines
1014 B
import nodemailer from 'nodemailer';
|
|
import Email from 'email-templates';
|
|
import { getSettings } from '../settings';
|
|
class PreparedEmail extends Email {
|
|
public constructor() {
|
|
const settings = getSettings().notifications.agents.email;
|
|
|
|
const transport = nodemailer.createTransport({
|
|
host: settings.options.smtpHost,
|
|
port: settings.options.smtpPort,
|
|
secure: settings.options.secure,
|
|
tls: settings.options.allowSelfSigned
|
|
? {
|
|
rejectUnauthorized: false,
|
|
}
|
|
: undefined,
|
|
auth:
|
|
settings.options.authUser && settings.options.authPass
|
|
? {
|
|
user: settings.options.authUser,
|
|
pass: settings.options.authPass,
|
|
}
|
|
: undefined,
|
|
});
|
|
super({
|
|
message: {
|
|
from: {
|
|
name: settings.options.senderName,
|
|
address: settings.options.emailFrom,
|
|
},
|
|
},
|
|
send: true,
|
|
transport: transport,
|
|
});
|
|
}
|
|
}
|
|
|
|
export default PreparedEmail;
|