diff --git a/social/email/61-email.html b/social/email/61-email.html
index 1d9a8459..c15e6ca0 100644
--- a/social/email/61-email.html
+++ b/social/email/61-email.html
@@ -157,6 +157,10 @@
+
+
+
+
@@ -238,9 +242,11 @@
var protocol = $("#node-input-authtype").val();
if (protocol === "BASIC") {
$(".node-input-password").show();
+ $(".node-input-saslformat").hide();
$(".node-input-token").hide();
} else {
$(".node-input-password").hide();
+ $(".node-input-saslformat").show();
$(".node-input-token").show();
}
});
@@ -260,6 +266,7 @@
autotls: {value: "never"},
port: {value:"993",required:true},
authtype: {value: "BASIC"},
+ saslformat: {value: true},
token: {value: "oauth2Response.access_token"},
box: {value:"INBOX"}, // For IMAP, The mailbox to process
disposition: { value: "Read" }, // For IMAP, the disposition of the read email
diff --git a/social/email/61-email.js b/social/email/61-email.js
index aecb4977..30c2ec0b 100644
--- a/social/email/61-email.js
+++ b/social/email/61-email.js
@@ -196,6 +196,7 @@ module.exports = function(RED) {
this.inport = n.port || (globalkeys && globalkeys.port) || "993";
this.box = n.box || "INBOX";
this.useSSL= n.useSSL;
+ this.saslformat = n.saslformat;
this.autotls= n.autotls;
this.token = n.token || "oAuth2Response.access_token";
this.protocol = n.protocol || "IMAP";
@@ -374,8 +375,12 @@ module.exports = function(RED) {
if(node.authtype == "XOAUTH2") {
var value = RED.util.getMessageProperty(msg,node.token);
if (value !== undefined) {
- //Make base64 string for access - compatible with outlook365 and gmail
- saslxoauth2 = Buffer.from("user="+node.userid+"\x01auth=Bearer "+value+"\x01\x01").toString('base64');
+ if(node.saslformat) {
+ //Make base64 string for access - compatible with outlook365 and gmail
+ saslxoauth2 = Buffer.from("user="+node.userid+"\x01auth=Bearer "+value+"\x01\x01").toString('base64');
+ } else {
+ saslxoauth2 = value;
+ }
}
imap = new Imap({
xoauth2: saslxoauth2,
diff --git a/social/email/locales/en-US/61-email.json b/social/email/locales/en-US/61-email.json
index 311b7c04..005b0098 100644
--- a/social/email/locales/en-US/61-email.json
+++ b/social/email/locales/en-US/61-email.json
@@ -32,6 +32,7 @@
"unseen": "Unseen",
"autotls": "Start TLS?",
"authtype": "Auth type",
+ "saslformat": "Format to SASL",
"token": "Token",
"never": "never",
"required": "if required",