Skip to content

Commit

Permalink
smtp set tls ciphers option (directus#7082)
Browse files Browse the repository at this point in the history
* smtp set tls ciphers option

* standarize tls config

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
  • Loading branch information
bernatvadell and rijkvanzanten authored Aug 6, 2021
1 parent 2193339 commit a951510
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion api/src/mailer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import nodemailer, { Transporter } from 'nodemailer';
import env from './env';
import logger from './logger';
import { getConfigFromEnv } from './utils/get-config-from-env';

let transporter: Transporter;

Expand All @@ -23,13 +24,16 @@ export default function getMailer(): Transporter {
};
}

const tls: Record<string, unknown> = getConfigFromEnv('EMAIL_SMTP_TLS_');

transporter = nodemailer.createTransport({
pool: env.EMAIL_SMTP_POOL,
host: env.EMAIL_SMTP_HOST,
port: env.EMAIL_SMTP_PORT,
secure: env.EMAIL_SMTP_SECURE,
ignoreTLS: env.EMAIL_SMTP_IGNORE_TLS,
auth: auth,
auth,
tls,
} as Record<string, unknown>);
} else if (env.EMAIL_TRANSPORT.toLowerCase() === 'mailgun') {
const mg = require('nodemailer-mailgun-transport');
Expand Down

0 comments on commit a951510

Please sign in to comment.