mirror of
https://github.com/eleith/emailjs.git
synced 2024-07-05 20:10:37 +00:00
allow for authentication preference to be customizable
This commit is contained in:
parent
3a89b55392
commit
fd8d74cc30
@ -116,6 +116,7 @@ server.send(message, function(err, message) { console.log(err || message); });
|
||||
tls // boolean or object (if true or object, starttls will be initiated)
|
||||
timeout // max number of milliseconds to wait for smtp responses (defaults to 5000)
|
||||
domain // domain to greet smtp with (defaults to os.hostname)
|
||||
authentication // array of preferred authentication methods (ex: email.authentication.PLAIN, email.authentication.XOAUTH2)
|
||||
}
|
||||
|
||||
## email.server.send(message, callback)
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "emailjs",
|
||||
"description": "send text/html emails and attachments (files, streams and strings) from node.js to any smtp server",
|
||||
"version": "0.3.15",
|
||||
"version": "0.3.16",
|
||||
"author": "eleith",
|
||||
"contributors": [
|
||||
"izuzak",
|
||||
|
@ -73,6 +73,7 @@ var SMTP = function(options) {
|
||||
this.ssl = options.ssl || false;
|
||||
this.tls = options.tls || false;
|
||||
this.monitor = null;
|
||||
this.authentication = options.authentication || [AUTH_METHODS.CRAM_MD5, AUTH_METHODS.LOGIN, AUTH_METHODS.PLAIN, AUTH_METHODS.XOAUTH2];
|
||||
|
||||
// keep these strings hidden when quicky debugging/logging
|
||||
this.user = function() {
|
||||
@ -449,7 +450,7 @@ SMTP.prototype = {
|
||||
// List of authentication methods we support: from preferred to
|
||||
// less preferred methods.
|
||||
if (!method) {
|
||||
var preferred = [AUTH_METHODS.CRAM_MD5, AUTH_METHODS.LOGIN, AUTH_METHODS.PLAIN, AUTH_METHODS.XOAUTH2];
|
||||
var preferred = self.authentication;
|
||||
|
||||
for (var i = 0; i < preferred.length; i++) {
|
||||
if ((self.features.auth || "").indexOf(preferred[i]) != -1) {
|
||||
@ -551,3 +552,4 @@ for (var each in events.EventEmitter.prototype) {
|
||||
|
||||
exports.SMTP = SMTP;
|
||||
exports.state = SMTPState;
|
||||
exports.authentication = AUTH_METHODS;
|
||||
|
Loading…
Reference in New Issue
Block a user