Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow disabling of TLS #54

Merged
merged 1 commit into from Dec 29, 2011
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/engines/SMTP.js
Expand Up @@ -59,6 +59,7 @@ exports.send = function(emailMessage, config, callback) {
user: emailMessage.SERVER.user,
pass: emailMessage.SERVER.pass,
ssl: emailMessage.SERVER.ssl,
tls: emailMessage.SERVER.tls,
debug: emailMessage.debug,
instanceId: config.instanceId
});
Expand Down Expand Up @@ -97,6 +98,7 @@ exports.SMTPClient = SMTPClient;
* defaults to OS hostname or "localhost"
* - use_authentication (Boolean): is authorization needed, default is false
* - ssl (Boolean): use SSL (port 465)
* - tls (Boolean): allow TLS (port 465)
* - user (String): the username if authorization is needed
* - pass (String): the password if authorization is needed
*
Expand Down Expand Up @@ -709,14 +711,17 @@ SMTPClient.prototype._handshake = function(callback){
this.remote_auth_cram_sha1 = true;
}

var shouldSupportTLS = this.options.tls !== false;
// check for TLS support
if(data.match(/STARTTLS/i)){
if(shouldSupportTLS && data.match(/STARTTLS/i)){
if(!this.remote_starttls) {
this.remote_starttls = true;
// start tls and rerun HELO
this._starttlsHandler(this._handshake.bind(this,callback));
return;
}
} else {
this.remote_starttls = false;
}

this.emit("connection_stable");
Expand Down