Make optional use of STARTTLS possible if required.
This commit is contained in:
parent
e52575ab87
commit
4c28187741
|
@ -7,7 +7,8 @@
|
|||
"from": "Sender Name <sender@example.com>",
|
||||
"smtp" : {
|
||||
"host": "mail.example.com",
|
||||
"port": 587,
|
||||
"port": 465,
|
||||
"starttls": false,
|
||||
"username": "sender@example.com",
|
||||
"password": "hunter2"
|
||||
}
|
||||
|
|
|
@ -10,7 +10,8 @@ async function sendEmail({ to, subject, html }) {
|
|||
const transporter = nodemailer.createTransport({
|
||||
host: config.mail.smtp.host,
|
||||
port: config.mail.smtp.port,
|
||||
secure: true,
|
||||
secure: !config.mail.smtp.starttls,
|
||||
requiretls: config.mail.smtp.starttls,
|
||||
auth: {
|
||||
user: config.mail.smtp.username,
|
||||
pass: config.mail.smtp.password,
|
||||
|
|
|
@ -16,7 +16,8 @@ const configSchema = Joi.object({
|
|||
from: Joi.string().required(),
|
||||
smtp: Joi.object({
|
||||
host: Joi.string().required(),
|
||||
port: Joi.number().default(587),
|
||||
port: Joi.number().default(465),
|
||||
starttls: Joi.boolean().default(false),
|
||||
username: Joi.string().required(),
|
||||
password: Joi.string().required(),
|
||||
}).required(),
|
||||
|
|
Loading…
Reference in a new issue