Unverified Commit 8ddbec6b authored by P. J. Reed's avatar P. J. Reed Committed by GitHub
Browse files

Allow anonymous SMTP connections (#59)

This adds support for anonymously connecting to SMTP servers
that do not require authentication; if a username is not provided,
it will not attempt to authenticate.
parent 3ce40c51
......@@ -34,8 +34,9 @@ module.exports = {
console.log("Email: to " + to_email + " in production.\nreply_to: " + reply_to + "\nsubject: " + subject + "\nbody: \n" + htmlText + "\n\n plaintext:\n" + plaintext);
} else if (config.get('mail_provider') === 'smtp') {
const transporter = nodemailer.createTransport({
let transporter;
if (config.has('mail_smtp_user')) {
transporter = nodemailer.createTransport({
host: config.get('mail_smtp_host'),
port: config.get('mail_smtp_port'),
secure: config.get('mail_smtp_secure'),
......@@ -45,6 +46,15 @@ module.exports = {
pass: config.get('mail_smtp_pass'),
}
});
} else {
transporter = nodemailer.createTransport({
host: config.get('mail_smtp_host'),
port: config.get('mail_smtp_port'),
secure: config.get('mail_smtp_secure'),
requireTLS: config.get('mail_smtp_require_tls'),
});
}
transporter.sendMail({
from: from,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment