mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
API: Add env var to opt-out mailer setup verification (#13924)
* Add env var to opt-out mailer setup verification * Add documentation
This commit is contained in:
@@ -137,6 +137,7 @@ const allowedEnvironmentVars = [
|
||||
// emails
|
||||
'EMAIL_FROM',
|
||||
'EMAIL_TRANSPORT',
|
||||
'EMAIL_VERIFY_SETUP',
|
||||
'EMAIL_SENDMAIL_NEW_LINE',
|
||||
'EMAIL_SENDMAIL_PATH',
|
||||
'EMAIL_SMTP_HOST',
|
||||
@@ -217,6 +218,7 @@ const defaults: Record<string, any> = {
|
||||
EXTENSIONS_AUTO_RELOAD: false,
|
||||
|
||||
EMAIL_FROM: 'no-reply@directus.io',
|
||||
EMAIL_VERIFY_SETUP: true,
|
||||
EMAIL_TRANSPORT: 'sendmail',
|
||||
EMAIL_SENDMAIL_NEW_LINE: 'unix',
|
||||
EMAIL_SENDMAIL_PATH: '/usr/sbin/sendmail',
|
||||
|
||||
@@ -36,12 +36,14 @@ export class MailService {
|
||||
this.knex = opts?.knex || getDatabase();
|
||||
this.mailer = getMailer();
|
||||
|
||||
this.mailer.verify((error) => {
|
||||
if (error) {
|
||||
logger.warn(`Email connection failed:`);
|
||||
logger.warn(error);
|
||||
}
|
||||
});
|
||||
if (env.EMAIL_VERIFY_SETUP) {
|
||||
this.mailer.verify((error) => {
|
||||
if (error) {
|
||||
logger.warn(`Email connection failed:`);
|
||||
logger.warn(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async send(options: EmailOptions): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user