diff --git a/api/config.json.example b/api/config.json.example index 4d36c87..d20310d 100644 --- a/api/config.json.example +++ b/api/config.json.example @@ -7,7 +7,8 @@ "from": "Sender Name ", "smtp" : { "host": "mail.example.com", - "port": 587, + "port": 465, + "starttls": false, "username": "sender@example.com", "password": "hunter2" } diff --git a/api/src/_helpers/send-email.js b/api/src/_helpers/send-email.js index 6afabe2..88ea6a3 100644 --- a/api/src/_helpers/send-email.js +++ b/api/src/_helpers/send-email.js @@ -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, diff --git a/api/src/config.js b/api/src/config.js index 90936f6..2206678 100644 --- a/api/src/config.js +++ b/api/src/config.js @@ -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(),