mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Allow nodemailer SMTP configuration with no authentication (#5673)
* Allow nodemailer SMTP configuration with no authentication * Fix typing + use or instead of and for user/pass combo Co-authored-by: Fady Khalife <fady.khalife@yakkazoo.com> Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
This commit is contained in:
@@ -11,16 +11,22 @@ if (env.EMAIL_TRANSPORT === 'sendmail') {
|
||||
path: env.EMAIL_SENDMAIL_PATH || '/usr/sbin/sendmail',
|
||||
});
|
||||
} else if (env.EMAIL_TRANSPORT.toLowerCase() === 'smtp') {
|
||||
let auth: boolean | { user?: string; pass?: string } = false;
|
||||
|
||||
if (env.EMAIL_SMTP_USER || env.EMAIL_SMTP_PASSWORD) {
|
||||
auth = {
|
||||
user: env.EMAIL_SMTP_USER,
|
||||
pass: env.EMAIL_SMTP_PASSWORD,
|
||||
};
|
||||
}
|
||||
|
||||
transporter = nodemailer.createTransport({
|
||||
pool: env.EMAIL_SMTP_POOL,
|
||||
host: env.EMAIL_SMTP_HOST,
|
||||
port: env.EMAIL_SMTP_PORT,
|
||||
secure: env.EMAIL_SMTP_SECURE,
|
||||
auth: {
|
||||
user: env.EMAIL_SMTP_USER,
|
||||
pass: env.EMAIL_SMTP_PASSWORD,
|
||||
},
|
||||
} as any);
|
||||
auth: auth,
|
||||
} as Record<string, unknown>);
|
||||
} else {
|
||||
logger.warn('Illegal transport given for email. Check the EMAIL_TRANSPORT env var.');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user