Skip to content

Commit

Permalink
[fix] mail: do not use auth if no auth is requested
Browse files Browse the repository at this point in the history
If the `auth` field in the email options is `{none}`, then no `auth`
should be added to the nodemailer.js options object. Otherwise,
authentication will be attempted with empty (and invalid) credentials.
  • Loading branch information
samueltardieu committed Jun 22, 2013
1 parent f09e413 commit d68365a
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions lib/plugins/mail/bslSmtp.nodejs
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,18 @@ var debug = false
args: ["-t -f "+mfrom_address_only]
});
} else {
var addr = option2default(via, addr.some)
var port = option2default(port, 25)
var secure = !(secure_type.none);
var user = option2default(user, "");
var pass = option2default(pass, "")
smtpTransport = nodemailer.createTransport("SMTP", {
host: addr,
port: port,
secureConnection: secure,
debug: debug,
auth: {
user:user,
pass:pass
}
});
var options = {
host: option2default(via, addr.some),
port: option2default(port, 25),
secureConnection: !(secure_type.none),
debug: debug};
if (!auth.none) {
options.auth = {
user: option2default(user, ""),
pass: option2default(pass, "")
};
}
smtpTransport = nodemailer.createTransport("SMTP", options);
}

if (dryrun) {
Expand Down

0 comments on commit d68365a

Please sign in to comment.