node-red-nodes/social/email/61-email.html

606 lines
27 KiB
HTML
Raw Normal View History

<script type="text/html" data-template-name="e-mail">
<div class="form-row">
2015-06-16 11:36:19 +02:00
<label for="node-input-name"><i class="fa fa-envelope"></i> <span data-i18n="email.label.to"></span></label>
<input type="text" id="node-input-name" placeholder="email@address.com">
</div>
<!-- <div class="form-row">
<label for="node-input-pin"><i class="fa fa-asterisk"></i> Service</label>
<select type="text" id="node-input-pin" style="width: 150px;">
<option value="-" disabled> </option>
<option value="DynectEmail">DynectEmail</option>
<option value="Gmail">Gmail</option>
<option value="hot.ee">hot.ee</option>
<option value="Hotmail">Hotmail</option>
<option value="iCloud">iCloud</option>
<option value="mail.ee">mail.ee</option>
<option value="Mail.Ru">Mail.Ru</option>
<option value="Mailgun">Mailgun</option>
<option value="Mailjet">Mailjet</option>
<option value="Mandrill">Mandrill</option>
<option value="Postmark">Postmark</option>
<option value="QQ">QQ</option>
<option value="QQex">QQex</option>
<option value="SendGrid">SendGrid</option>
<option value="SendCloud">SendCloud</option>
<option value="SES">SES</option>
<option value="Yahoo">Yahoo</option>
<option value="yandex">yandex</option>
<option value="Zoho">Zoho</option>
</select>
</div> -->
<div class="form-row">
2015-06-16 11:36:19 +02:00
<label for="node-input-server"><i class="fa fa-globe"></i> <span data-i18n="email.label.server"></span></label>
<input type="text" id="node-input-server" placeholder="smtp.gmail.com">
</div>
<div class="form-row">
2015-06-16 11:36:19 +02:00
<label for="node-input-port"><i class="fa fa-random"></i> <span data-i18n="email.label.port"></span></label>
<input type="text" id="node-input-port" placeholder="465" style="width:100px">
<label style="width:40px"> </label>
<input type="checkbox" id="node-input-secure" style="display:inline-block; width:20px; vertical-align:baseline;">
<span data-i18n="email.label.useSecureConnection"></span>
</div>
<div class="form-row">
XOAuth2 for Email-In node (#975) * Update PULL_REQUEST_TEMPLATE.md * Add new UI elements to Email In node Locale for en-US Added Auth type and Token field to Email IN Dynamically appear based on selection * XOAUTH2 IMAP Minor UI changes. Exposing only XOAuth2. Picks up raw access token from input message specified. Only works for IMAP Token formatted by node for Exchange and GMail, won't work on other providers. Only works on trigger, not timer TODO: Add POP XOAUTH2 capability Add SMTP XOAUTH2 capability Add option to pass SASL XAOUTH2 token rather than raw OAUTH2 token * SASL Format Added checkbox to turn off SASL formatting if the user wants to do this themselves * XOAuth2 forces input Using XOauth2 forces triggered node, and automatic trigger sets auth to basic; XOAuth2 needs token from flow * Error reporting Password missing error only occurs if set to basic authentication. Token missing only occurs if set to XOAuth2. * Unit tests Make sure basic authentication is selected by default, and that an additional input is created and timed triggers are turned off for XOauth2 * Cleanup and README Remove old code, update readme * XOauth2 IMAP Release Prevent XOAuth2 being used for POP. Update PR Template. Updated help file. Bumped version to 1.19-beta * Update POP3 dependency Removed dependency to poplib.js, moved to node-pop3. Re-wrote checkPOP3 function asynchronously using the new library. Added some node.status changes to mimic IMAP behaviour. * XOAUTH2 POP3 Added checking for authentication type to allow XOauth2 tokens to be sent to POP server. Turned off UI restrictions for this functionality. * XOAUTH2 POP3 Release Updated help docs and version to reflect changes. * Add new UI elements to Email Out node Add option for XAouth2 for SMTP node * XOAUTH2 SMTP Exposing functionality for OAuth2 through Nodemailer. Added some error reporting if credentials are missing to match the Email-In node. * XOAUTH2 SMTP Release Updated help file to reflect changes. * Unit Tests for Email Out Modified tests to allow these unit tests to pass, but does not address the fault caused by the Node Test Helper - credentials only loaded after the flow has been loaded. --------- Co-authored-by: Dave Conway-Jones <dceejay@users.noreply.github.com>
2023-03-27 21:27:47 +02:00
<label for="node-input-authtype"><i class="fa fa-tasks"></i> <span data-i18n="email.label.authtype"></span></label>
<select type="text" id="node-input-authtype">
<option value="BASIC">Basic</option>
<option value="XOAUTH2">XOAuth2</option>
<option value="NONE">None</option>
XOAuth2 for Email-In node (#975) * Update PULL_REQUEST_TEMPLATE.md * Add new UI elements to Email In node Locale for en-US Added Auth type and Token field to Email IN Dynamically appear based on selection * XOAUTH2 IMAP Minor UI changes. Exposing only XOAuth2. Picks up raw access token from input message specified. Only works for IMAP Token formatted by node for Exchange and GMail, won't work on other providers. Only works on trigger, not timer TODO: Add POP XOAUTH2 capability Add SMTP XOAUTH2 capability Add option to pass SASL XAOUTH2 token rather than raw OAUTH2 token * SASL Format Added checkbox to turn off SASL formatting if the user wants to do this themselves * XOAuth2 forces input Using XOauth2 forces triggered node, and automatic trigger sets auth to basic; XOAuth2 needs token from flow * Error reporting Password missing error only occurs if set to basic authentication. Token missing only occurs if set to XOAuth2. * Unit tests Make sure basic authentication is selected by default, and that an additional input is created and timed triggers are turned off for XOauth2 * Cleanup and README Remove old code, update readme * XOauth2 IMAP Release Prevent XOAuth2 being used for POP. Update PR Template. Updated help file. Bumped version to 1.19-beta * Update POP3 dependency Removed dependency to poplib.js, moved to node-pop3. Re-wrote checkPOP3 function asynchronously using the new library. Added some node.status changes to mimic IMAP behaviour. * XOAUTH2 POP3 Added checking for authentication type to allow XOauth2 tokens to be sent to POP server. Turned off UI restrictions for this functionality. * XOAUTH2 POP3 Release Updated help docs and version to reflect changes. * Add new UI elements to Email Out node Add option for XAouth2 for SMTP node * XOAUTH2 SMTP Exposing functionality for OAuth2 through Nodemailer. Added some error reporting if credentials are missing to match the Email-In node. * XOAUTH2 SMTP Release Updated help file to reflect changes. * Unit Tests for Email Out Modified tests to allow these unit tests to pass, but does not address the fault caused by the Node Test Helper - credentials only loaded after the flow has been loaded. --------- Co-authored-by: Dave Conway-Jones <dceejay@users.noreply.github.com>
2023-03-27 21:27:47 +02:00
</select>
</div>
<div class="form-row node-input-userid">
2015-06-16 11:36:19 +02:00
<label for="node-input-userid"><i class="fa fa-user"></i> <span data-i18n="email.label.userid"></span></label>
<input type="text" id="node-input-userid">
</div>
XOAuth2 for Email-In node (#975) * Update PULL_REQUEST_TEMPLATE.md * Add new UI elements to Email In node Locale for en-US Added Auth type and Token field to Email IN Dynamically appear based on selection * XOAUTH2 IMAP Minor UI changes. Exposing only XOAuth2. Picks up raw access token from input message specified. Only works for IMAP Token formatted by node for Exchange and GMail, won't work on other providers. Only works on trigger, not timer TODO: Add POP XOAUTH2 capability Add SMTP XOAUTH2 capability Add option to pass SASL XAOUTH2 token rather than raw OAUTH2 token * SASL Format Added checkbox to turn off SASL formatting if the user wants to do this themselves * XOAuth2 forces input Using XOauth2 forces triggered node, and automatic trigger sets auth to basic; XOAuth2 needs token from flow * Error reporting Password missing error only occurs if set to basic authentication. Token missing only occurs if set to XOAuth2. * Unit tests Make sure basic authentication is selected by default, and that an additional input is created and timed triggers are turned off for XOauth2 * Cleanup and README Remove old code, update readme * XOauth2 IMAP Release Prevent XOAuth2 being used for POP. Update PR Template. Updated help file. Bumped version to 1.19-beta * Update POP3 dependency Removed dependency to poplib.js, moved to node-pop3. Re-wrote checkPOP3 function asynchronously using the new library. Added some node.status changes to mimic IMAP behaviour. * XOAUTH2 POP3 Added checking for authentication type to allow XOauth2 tokens to be sent to POP server. Turned off UI restrictions for this functionality. * XOAUTH2 POP3 Release Updated help docs and version to reflect changes. * Add new UI elements to Email Out node Add option for XAouth2 for SMTP node * XOAUTH2 SMTP Exposing functionality for OAuth2 through Nodemailer. Added some error reporting if credentials are missing to match the Email-In node. * XOAUTH2 SMTP Release Updated help file to reflect changes. * Unit Tests for Email Out Modified tests to allow these unit tests to pass, but does not address the fault caused by the Node Test Helper - credentials only loaded after the flow has been loaded. --------- Co-authored-by: Dave Conway-Jones <dceejay@users.noreply.github.com>
2023-03-27 21:27:47 +02:00
<div class="form-row node-input-password">
2015-06-16 11:36:19 +02:00
<label for="node-input-password"><i class="fa fa-lock"></i> <span data-i18n="email.label.password"></span></label>
<input type="password" id="node-input-password">
</div>
XOAuth2 for Email-In node (#975) * Update PULL_REQUEST_TEMPLATE.md * Add new UI elements to Email In node Locale for en-US Added Auth type and Token field to Email IN Dynamically appear based on selection * XOAUTH2 IMAP Minor UI changes. Exposing only XOAuth2. Picks up raw access token from input message specified. Only works for IMAP Token formatted by node for Exchange and GMail, won't work on other providers. Only works on trigger, not timer TODO: Add POP XOAUTH2 capability Add SMTP XOAUTH2 capability Add option to pass SASL XAOUTH2 token rather than raw OAUTH2 token * SASL Format Added checkbox to turn off SASL formatting if the user wants to do this themselves * XOAuth2 forces input Using XOauth2 forces triggered node, and automatic trigger sets auth to basic; XOAuth2 needs token from flow * Error reporting Password missing error only occurs if set to basic authentication. Token missing only occurs if set to XOAuth2. * Unit tests Make sure basic authentication is selected by default, and that an additional input is created and timed triggers are turned off for XOauth2 * Cleanup and README Remove old code, update readme * XOauth2 IMAP Release Prevent XOAuth2 being used for POP. Update PR Template. Updated help file. Bumped version to 1.19-beta * Update POP3 dependency Removed dependency to poplib.js, moved to node-pop3. Re-wrote checkPOP3 function asynchronously using the new library. Added some node.status changes to mimic IMAP behaviour. * XOAUTH2 POP3 Added checking for authentication type to allow XOauth2 tokens to be sent to POP server. Turned off UI restrictions for this functionality. * XOAUTH2 POP3 Release Updated help docs and version to reflect changes. * Add new UI elements to Email Out node Add option for XAouth2 for SMTP node * XOAUTH2 SMTP Exposing functionality for OAuth2 through Nodemailer. Added some error reporting if credentials are missing to match the Email-In node. * XOAUTH2 SMTP Release Updated help file to reflect changes. * Unit Tests for Email Out Modified tests to allow these unit tests to pass, but does not address the fault caused by the Node Test Helper - credentials only loaded after the flow has been loaded. --------- Co-authored-by: Dave Conway-Jones <dceejay@users.noreply.github.com>
2023-03-27 21:27:47 +02:00
<div class="form-row node-input-saslformat" style="display: none;">
<label for="node-input-saslformat"><i class="fa fa-code"></i> <span data-i18n="email.label.saslformat"></span></label>
<input type="checkbox" id="node-input-saslformat" style="width: auto;">
</div>
<div class="form-row node-input-token" style="display: none;">
<label for="node-input-token"><i class="fa fa-lock"></i> <span data-i18n="email.label.token"></span></label>
<input type="text" id="node-input-token" placeholder="oauth2Response.access_token">
</div>
<br/>
<div class="form-row node-input-useTLS">
<label for="node-input-useTLS"><i class="fa fa-lock"></i> <span data-i18n="email.label.useTLS"></label>
<input type="checkbox" id="node-input-tls" style="display:inline-block; width:20px; vertical-align:baseline;">
2021-05-11 10:22:09 +02:00
<span data-i18n="email.label.rejectUnauthorised"></span>
</div>
<div class="form-row">
<label for="node-input-dname"><i class="fa fa-tag"></i> <span data-i18n="node-red:common.label.name"></span></label>
<input type="text" id="node-input-dname" data-i18n="[placeholder]node-red:common.label.name">
</div>
2015-06-16 11:36:19 +02:00
<div class="form-tips" id="node-tip"><span data-i18n="[html]email.tip.cred"></span></div>
</script>
<script type="text/javascript">
(function() {
RED.nodes.registerType('e-mail',{
category: 'social-output',
color:"#c7e9c0",
defaults: {
server: {value:"smtp.gmail.com",required:true},
port: {value:"465",required:true},
XOAuth2 for Email-In node (#975) * Update PULL_REQUEST_TEMPLATE.md * Add new UI elements to Email In node Locale for en-US Added Auth type and Token field to Email IN Dynamically appear based on selection * XOAUTH2 IMAP Minor UI changes. Exposing only XOAuth2. Picks up raw access token from input message specified. Only works for IMAP Token formatted by node for Exchange and GMail, won't work on other providers. Only works on trigger, not timer TODO: Add POP XOAUTH2 capability Add SMTP XOAUTH2 capability Add option to pass SASL XAOUTH2 token rather than raw OAUTH2 token * SASL Format Added checkbox to turn off SASL formatting if the user wants to do this themselves * XOAuth2 forces input Using XOauth2 forces triggered node, and automatic trigger sets auth to basic; XOAuth2 needs token from flow * Error reporting Password missing error only occurs if set to basic authentication. Token missing only occurs if set to XOAuth2. * Unit tests Make sure basic authentication is selected by default, and that an additional input is created and timed triggers are turned off for XOauth2 * Cleanup and README Remove old code, update readme * XOauth2 IMAP Release Prevent XOAuth2 being used for POP. Update PR Template. Updated help file. Bumped version to 1.19-beta * Update POP3 dependency Removed dependency to poplib.js, moved to node-pop3. Re-wrote checkPOP3 function asynchronously using the new library. Added some node.status changes to mimic IMAP behaviour. * XOAUTH2 POP3 Added checking for authentication type to allow XOauth2 tokens to be sent to POP server. Turned off UI restrictions for this functionality. * XOAUTH2 POP3 Release Updated help docs and version to reflect changes. * Add new UI elements to Email Out node Add option for XAouth2 for SMTP node * XOAUTH2 SMTP Exposing functionality for OAuth2 through Nodemailer. Added some error reporting if credentials are missing to match the Email-In node. * XOAUTH2 SMTP Release Updated help file to reflect changes. * Unit Tests for Email Out Modified tests to allow these unit tests to pass, but does not address the fault caused by the Node Test Helper - credentials only loaded after the flow has been loaded. --------- Co-authored-by: Dave Conway-Jones <dceejay@users.noreply.github.com>
2023-03-27 21:27:47 +02:00
authtype: {value: "BASIC"},
saslformat: {value: true},
token: {value: "oauth2Response.access_token"},
secure: {value: true},
tls: {value: true},
name: {value:""},
dname: {value:""}
},
credentials: {
userid: {type:"text"},
password: {type: "password"},
global: { type:"boolean"}
},
inputs:1,
outputs:0,
icon: "envelope.png",
align: "right",
2018-04-14 23:43:14 +02:00
paletteLabel: function() {
return this._("email.email");
},
label: function() {
2020-10-19 13:24:18 +02:00
return this.dname||this.name||this._("email.email");
},
labelStyle: function() {
return (this.dname)?"node_label_italic":"";
},
oneditprepare: function() {
if (this.authtype === undefined) {
this.authtype = "BASIC";
$("#node-input-authtype").val('BASIC');
}
$("#node-input-authtype").change(function() {
var protocol = $("#node-input-authtype").val();
if (protocol === "BASIC") {
$(".node-input-userid").show();
$(".node-input-password").show();
$(".node-input-saslformat").hide();
$(".node-input-token").hide();
$(".node-input-useTLS").show();
} else if (protocol === "NONE") {
$(".node-input-userid").hide();
$(".node-input-password").hide();
$(".node-input-saslformat").hide();
$(".node-input-token").hide();
$(".node-input-useTLS").hide();
} else {
$(".node-input-userid").show();
$(".node-input-password").hide();
$(".node-input-saslformat").show();
$(".node-input-token").show();
$("#node-input-fetch").val("trigger");
$("#node-input-fetch").change();
$(".node-input-useTLS").show();
}
});
if (this.credentials.global) {
$('#node-tip').show();
} else {
$('#node-tip').hide();
}
XOAuth2 for Email-In node (#975) * Update PULL_REQUEST_TEMPLATE.md * Add new UI elements to Email In node Locale for en-US Added Auth type and Token field to Email IN Dynamically appear based on selection * XOAUTH2 IMAP Minor UI changes. Exposing only XOAuth2. Picks up raw access token from input message specified. Only works for IMAP Token formatted by node for Exchange and GMail, won't work on other providers. Only works on trigger, not timer TODO: Add POP XOAUTH2 capability Add SMTP XOAUTH2 capability Add option to pass SASL XAOUTH2 token rather than raw OAUTH2 token * SASL Format Added checkbox to turn off SASL formatting if the user wants to do this themselves * XOAuth2 forces input Using XOauth2 forces triggered node, and automatic trigger sets auth to basic; XOAuth2 needs token from flow * Error reporting Password missing error only occurs if set to basic authentication. Token missing only occurs if set to XOAuth2. * Unit tests Make sure basic authentication is selected by default, and that an additional input is created and timed triggers are turned off for XOauth2 * Cleanup and README Remove old code, update readme * XOauth2 IMAP Release Prevent XOAuth2 being used for POP. Update PR Template. Updated help file. Bumped version to 1.19-beta * Update POP3 dependency Removed dependency to poplib.js, moved to node-pop3. Re-wrote checkPOP3 function asynchronously using the new library. Added some node.status changes to mimic IMAP behaviour. * XOAUTH2 POP3 Added checking for authentication type to allow XOauth2 tokens to be sent to POP server. Turned off UI restrictions for this functionality. * XOAUTH2 POP3 Release Updated help docs and version to reflect changes. * Add new UI elements to Email Out node Add option for XAouth2 for SMTP node * XOAUTH2 SMTP Exposing functionality for OAuth2 through Nodemailer. Added some error reporting if credentials are missing to match the Email-In node. * XOAUTH2 SMTP Release Updated help file to reflect changes. * Unit Tests for Email Out Modified tests to allow these unit tests to pass, but does not address the fault caused by the Node Test Helper - credentials only loaded after the flow has been loaded. --------- Co-authored-by: Dave Conway-Jones <dceejay@users.noreply.github.com>
2023-03-27 21:27:47 +02:00
$("#node-input-token").typedInput({
type:'msg',
types:['msg']
});
}
});
})();
</script>
<script type="text/html" data-template-name="e-mail in">
<div class="form-row">
<label for="node-input-fetch"><i class="fa fa-hourglass-half"></i> <span data-i18n="email.label.getmail"></span></label>
<select type="text" id="node-input-fetch" style="width:130px;">
<option value="auto" data-i18n="email.label.auto"></option>
<option value="trigger" data-i18n="email.label.trigger"></option>
</select>
<span id="node-repeatTime">
<span style="margin-left:20px;" data-i18n="email.label.repeat"></span>
<input type="text" id="node-input-repeat" style="width:80px"> <span data-i18n="email.label.seconds">seconds</span>
</span>
</div>
<div class="form-row">
<label for="node-input-protocol"><i class="fa fa-envelope"></i> <span data-i18n="email.label.protocol"></span></label>
<select type="text" id="node-input-protocol">
<option value="IMAP">IMAP</option>
<option value="POP3">POP3</option>
</select>
</div>
<div class="form-row">
<label for="node-input-useSSL"><i class="fa fa-lock"></i> <span data-i18n="email.label.useSSL"></span></label>
<input type="checkbox" id="node-input-useSSL" style="width: auto;">
</div>
<div class="form-row">
<label for="node-input-autotls"><i class="fa fa-lock"></i> <span data-i18n="email.label.autotls"></label>
2021-04-15 11:32:40 +02:00
<select type="text" id="node-input-autotls" style="width: 150px;">
<option value="never" data-i18n="email.label.never"></option>
<option value="required" data-i18n="email.label.required"></option>
<option value="always" data-i18n="email.label.always"></option>
</select>
</div>
<div class="form-row">
2015-06-16 11:36:19 +02:00
<label for="node-input-server"><i class="fa fa-globe"></i> <span data-i18n="email.label.server"></span></label>
<input type="text" id="node-input-server" placeholder="imap.gmail.com">
</div>
<div class="form-row">
2015-06-16 11:36:19 +02:00
<label for="node-input-port"><i class="fa fa-random"></i> <span data-i18n="email.label.port"></span></label>
<input type="text" id="node-input-port" placeholder="993">
</div>
<div class="form-row">
XOAuth2 for Email-In node (#975) * Update PULL_REQUEST_TEMPLATE.md * Add new UI elements to Email In node Locale for en-US Added Auth type and Token field to Email IN Dynamically appear based on selection * XOAUTH2 IMAP Minor UI changes. Exposing only XOAuth2. Picks up raw access token from input message specified. Only works for IMAP Token formatted by node for Exchange and GMail, won't work on other providers. Only works on trigger, not timer TODO: Add POP XOAUTH2 capability Add SMTP XOAUTH2 capability Add option to pass SASL XAOUTH2 token rather than raw OAUTH2 token * SASL Format Added checkbox to turn off SASL formatting if the user wants to do this themselves * XOAuth2 forces input Using XOauth2 forces triggered node, and automatic trigger sets auth to basic; XOAuth2 needs token from flow * Error reporting Password missing error only occurs if set to basic authentication. Token missing only occurs if set to XOAuth2. * Unit tests Make sure basic authentication is selected by default, and that an additional input is created and timed triggers are turned off for XOauth2 * Cleanup and README Remove old code, update readme * XOauth2 IMAP Release Prevent XOAuth2 being used for POP. Update PR Template. Updated help file. Bumped version to 1.19-beta * Update POP3 dependency Removed dependency to poplib.js, moved to node-pop3. Re-wrote checkPOP3 function asynchronously using the new library. Added some node.status changes to mimic IMAP behaviour. * XOAUTH2 POP3 Added checking for authentication type to allow XOauth2 tokens to be sent to POP server. Turned off UI restrictions for this functionality. * XOAUTH2 POP3 Release Updated help docs and version to reflect changes. * Add new UI elements to Email Out node Add option for XAouth2 for SMTP node * XOAUTH2 SMTP Exposing functionality for OAuth2 through Nodemailer. Added some error reporting if credentials are missing to match the Email-In node. * XOAUTH2 SMTP Release Updated help file to reflect changes. * Unit Tests for Email Out Modified tests to allow these unit tests to pass, but does not address the fault caused by the Node Test Helper - credentials only loaded after the flow has been loaded. --------- Co-authored-by: Dave Conway-Jones <dceejay@users.noreply.github.com>
2023-03-27 21:27:47 +02:00
<label for="node-input-authtype"><i class="fa fa-tasks"></i> <span data-i18n="email.label.authtype"></span></label>
<select type="text" id="node-input-authtype">
<option value="BASIC">Basic</option>
<option value="XOAUTH2">XOAuth2</option>
<option value="NONE">None</option>
XOAuth2 for Email-In node (#975) * Update PULL_REQUEST_TEMPLATE.md * Add new UI elements to Email In node Locale for en-US Added Auth type and Token field to Email IN Dynamically appear based on selection * XOAUTH2 IMAP Minor UI changes. Exposing only XOAuth2. Picks up raw access token from input message specified. Only works for IMAP Token formatted by node for Exchange and GMail, won't work on other providers. Only works on trigger, not timer TODO: Add POP XOAUTH2 capability Add SMTP XOAUTH2 capability Add option to pass SASL XAOUTH2 token rather than raw OAUTH2 token * SASL Format Added checkbox to turn off SASL formatting if the user wants to do this themselves * XOAuth2 forces input Using XOauth2 forces triggered node, and automatic trigger sets auth to basic; XOAuth2 needs token from flow * Error reporting Password missing error only occurs if set to basic authentication. Token missing only occurs if set to XOAuth2. * Unit tests Make sure basic authentication is selected by default, and that an additional input is created and timed triggers are turned off for XOauth2 * Cleanup and README Remove old code, update readme * XOauth2 IMAP Release Prevent XOAuth2 being used for POP. Update PR Template. Updated help file. Bumped version to 1.19-beta * Update POP3 dependency Removed dependency to poplib.js, moved to node-pop3. Re-wrote checkPOP3 function asynchronously using the new library. Added some node.status changes to mimic IMAP behaviour. * XOAUTH2 POP3 Added checking for authentication type to allow XOauth2 tokens to be sent to POP server. Turned off UI restrictions for this functionality. * XOAUTH2 POP3 Release Updated help docs and version to reflect changes. * Add new UI elements to Email Out node Add option for XAouth2 for SMTP node * XOAUTH2 SMTP Exposing functionality for OAuth2 through Nodemailer. Added some error reporting if credentials are missing to match the Email-In node. * XOAUTH2 SMTP Release Updated help file to reflect changes. * Unit Tests for Email Out Modified tests to allow these unit tests to pass, but does not address the fault caused by the Node Test Helper - credentials only loaded after the flow has been loaded. --------- Co-authored-by: Dave Conway-Jones <dceejay@users.noreply.github.com>
2023-03-27 21:27:47 +02:00
</select>
</div>
<div class="form-row node-input-userid" id="node-userid">
2015-06-16 11:36:19 +02:00
<label for="node-input-userid"><i class="fa fa-user"></i> <span data-i18n="email.label.userid"></span></label>
<input type="text" id="node-input-userid">
</div>
<div class="form-row node-input-password" id="node-password">
2015-06-16 11:36:19 +02:00
<label for="node-input-password"><i class="fa fa-lock"></i> <span data-i18n="email.label.password"></span></label>
<input type="password" id="node-input-password">
</div>
XOAuth2 for Email-In node (#975) * Update PULL_REQUEST_TEMPLATE.md * Add new UI elements to Email In node Locale for en-US Added Auth type and Token field to Email IN Dynamically appear based on selection * XOAUTH2 IMAP Minor UI changes. Exposing only XOAuth2. Picks up raw access token from input message specified. Only works for IMAP Token formatted by node for Exchange and GMail, won't work on other providers. Only works on trigger, not timer TODO: Add POP XOAUTH2 capability Add SMTP XOAUTH2 capability Add option to pass SASL XAOUTH2 token rather than raw OAUTH2 token * SASL Format Added checkbox to turn off SASL formatting if the user wants to do this themselves * XOAuth2 forces input Using XOauth2 forces triggered node, and automatic trigger sets auth to basic; XOAuth2 needs token from flow * Error reporting Password missing error only occurs if set to basic authentication. Token missing only occurs if set to XOAuth2. * Unit tests Make sure basic authentication is selected by default, and that an additional input is created and timed triggers are turned off for XOauth2 * Cleanup and README Remove old code, update readme * XOauth2 IMAP Release Prevent XOAuth2 being used for POP. Update PR Template. Updated help file. Bumped version to 1.19-beta * Update POP3 dependency Removed dependency to poplib.js, moved to node-pop3. Re-wrote checkPOP3 function asynchronously using the new library. Added some node.status changes to mimic IMAP behaviour. * XOAUTH2 POP3 Added checking for authentication type to allow XOauth2 tokens to be sent to POP server. Turned off UI restrictions for this functionality. * XOAUTH2 POP3 Release Updated help docs and version to reflect changes. * Add new UI elements to Email Out node Add option for XAouth2 for SMTP node * XOAUTH2 SMTP Exposing functionality for OAuth2 through Nodemailer. Added some error reporting if credentials are missing to match the Email-In node. * XOAUTH2 SMTP Release Updated help file to reflect changes. * Unit Tests for Email Out Modified tests to allow these unit tests to pass, but does not address the fault caused by the Node Test Helper - credentials only loaded after the flow has been loaded. --------- Co-authored-by: Dave Conway-Jones <dceejay@users.noreply.github.com>
2023-03-27 21:27:47 +02:00
<div class="form-row node-input-saslformat" style="display: none;">
<label for="node-input-saslformat"><i class="fa fa-code"></i> <span data-i18n="email.label.saslformat"></span></label>
<input type="checkbox" id="node-input-saslformat" style="width: auto;">
</div>
<div class="form-row node-input-token" style="display: none;">
<label for="node-input-token"><i class="fa fa-lock"></i> <span data-i18n="email.label.token"></span></label>
<input type="text" id="node-input-token" placeholder="oauth2Response.access_token">
</div>
<div class="form-row node-input-box">
2015-06-16 11:36:19 +02:00
<label for="node-input-box"><i class="fa fa-inbox"></i> <span data-i18n="email.label.folder"></span></label>
<input type="text" id="node-input-box">
</div>
<div class="form-row node-input-disposition">
<label for="node-input-disposition"><i class="fa fa-trash"></i> <span data-i18n="email.label.disposition"></span></label>
<select type="text" id="node-input-disposition">
<option value="None" selected="selected" data-i18n="email.label.none"></option>
<option value="Read" data-i18n="email.label.read"></option>
<option value="Delete" data-i18n="email.label.delete"></option>
</select>
</div>
<div class="form-row">
2019-02-11 21:10:31 +01:00
<label for="node-input-criteria"><i class="fa fa-search"></i> <span data-i18n="email.label.criteria"></span></label>
<select type="text" id="node-input-criteria">
2019-02-11 21:10:31 +01:00
<option value="ALL" data-i18n="email.label.all"></option>
<option value="ANSWERED" data-i18n="email.label.answered"></option>
<option value="FLAGGED" data-i18n="email.label.flagged"></option>
2019-02-11 21:10:31 +01:00
<option value="SEEN" data-i18n="email.label.seen"></option>
<option value="UNANSWERED" data-i18n="email.label.unanswered"></option>
<option value="UNFLAGGED" data-i18n="email.label.unflagged"></option>
<option value="UNSEEN" selected="selected" data-i18n="email.label.unseen"></option>
<option value="_msg_" data-i18n="email.label.criteriaFromMsg"></option>
<!--
<option value="DELETED" data-i18n="email.label.delete"></option>
2019-02-11 21:10:31 +01:00
<option value="DRAFT" data-i18n="email.label.none"></option>
<option value="NEW" data-i18n="email.label.delete"></option>
<option value="UNDELETED" data-i18n="email.label.read"></option>
<option value="UNDRAFT" data-i18n="email.label.delete"></option>
<option value="RECENT" data-i18n="email.label.read"></option>
<option value="OLD" data-i18n="email.label.delete"></option>
-->
</select>
</div>
<br/>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="node-red:common.label.name"></span></label>
<input type="text" id="node-input-name" data-i18n="[placeholder]node-red:common.label.name">
</div>
<script>
var checkPorts = function() {
var currentPort = $("#node-input-port").val();
if (currentPort === "143" || currentPort === "993" || currentPort === "110" || currentPort == "995") {
if ($("#node-input-useSSL").prop("checked") === true) {
$("#node-input-port").val($("#node-input-protocol").val() === "IMAP"?"993":"995");
} else {
$("#node-input-port").val($("#node-input-protocol").val() === "IMAP"?"143":"110");
}
}
};
$("#node-input-useSSL").change(function(x, y) {
// console.log("useSSL: x="+ JSON.stringify(x) + ", y=" + y);
// console.log("Value: " + $("#node-input-useSSL").prop("checked"));
checkPorts();
});
$("#node-input-protocol").change(function() {
var protocol = $("#node-input-protocol").val();
if (protocol === "IMAP") {
$(".node-input-autotls").show();
$(".node-input-box").show();
$(".node-input-disposition").show();
$(".node-input-criteria").show();
} else {
$(".node-input-autotls").hide();
$(".node-input-box").hide();
$(".node-input-disposition").hide();
$(".node-input-criteria").hide();
}
checkPorts();
});
XOAuth2 for Email-In node (#975) * Update PULL_REQUEST_TEMPLATE.md * Add new UI elements to Email In node Locale for en-US Added Auth type and Token field to Email IN Dynamically appear based on selection * XOAUTH2 IMAP Minor UI changes. Exposing only XOAuth2. Picks up raw access token from input message specified. Only works for IMAP Token formatted by node for Exchange and GMail, won't work on other providers. Only works on trigger, not timer TODO: Add POP XOAUTH2 capability Add SMTP XOAUTH2 capability Add option to pass SASL XAOUTH2 token rather than raw OAUTH2 token * SASL Format Added checkbox to turn off SASL formatting if the user wants to do this themselves * XOAuth2 forces input Using XOauth2 forces triggered node, and automatic trigger sets auth to basic; XOAuth2 needs token from flow * Error reporting Password missing error only occurs if set to basic authentication. Token missing only occurs if set to XOAuth2. * Unit tests Make sure basic authentication is selected by default, and that an additional input is created and timed triggers are turned off for XOauth2 * Cleanup and README Remove old code, update readme * XOauth2 IMAP Release Prevent XOAuth2 being used for POP. Update PR Template. Updated help file. Bumped version to 1.19-beta * Update POP3 dependency Removed dependency to poplib.js, moved to node-pop3. Re-wrote checkPOP3 function asynchronously using the new library. Added some node.status changes to mimic IMAP behaviour. * XOAUTH2 POP3 Added checking for authentication type to allow XOauth2 tokens to be sent to POP server. Turned off UI restrictions for this functionality. * XOAUTH2 POP3 Release Updated help docs and version to reflect changes. * Add new UI elements to Email Out node Add option for XAouth2 for SMTP node * XOAUTH2 SMTP Exposing functionality for OAuth2 through Nodemailer. Added some error reporting if credentials are missing to match the Email-In node. * XOAUTH2 SMTP Release Updated help file to reflect changes. * Unit Tests for Email Out Modified tests to allow these unit tests to pass, but does not address the fault caused by the Node Test Helper - credentials only loaded after the flow has been loaded. --------- Co-authored-by: Dave Conway-Jones <dceejay@users.noreply.github.com>
2023-03-27 21:27:47 +02:00
$("#node-input-authtype").change(function() {
var protocol = $("#node-input-authtype").val();
if (protocol === "BASIC") {
$(".node-input-userid").show();
XOAuth2 for Email-In node (#975) * Update PULL_REQUEST_TEMPLATE.md * Add new UI elements to Email In node Locale for en-US Added Auth type and Token field to Email IN Dynamically appear based on selection * XOAUTH2 IMAP Minor UI changes. Exposing only XOAuth2. Picks up raw access token from input message specified. Only works for IMAP Token formatted by node for Exchange and GMail, won't work on other providers. Only works on trigger, not timer TODO: Add POP XOAUTH2 capability Add SMTP XOAUTH2 capability Add option to pass SASL XAOUTH2 token rather than raw OAUTH2 token * SASL Format Added checkbox to turn off SASL formatting if the user wants to do this themselves * XOAuth2 forces input Using XOauth2 forces triggered node, and automatic trigger sets auth to basic; XOAuth2 needs token from flow * Error reporting Password missing error only occurs if set to basic authentication. Token missing only occurs if set to XOAuth2. * Unit tests Make sure basic authentication is selected by default, and that an additional input is created and timed triggers are turned off for XOauth2 * Cleanup and README Remove old code, update readme * XOauth2 IMAP Release Prevent XOAuth2 being used for POP. Update PR Template. Updated help file. Bumped version to 1.19-beta * Update POP3 dependency Removed dependency to poplib.js, moved to node-pop3. Re-wrote checkPOP3 function asynchronously using the new library. Added some node.status changes to mimic IMAP behaviour. * XOAUTH2 POP3 Added checking for authentication type to allow XOauth2 tokens to be sent to POP server. Turned off UI restrictions for this functionality. * XOAUTH2 POP3 Release Updated help docs and version to reflect changes. * Add new UI elements to Email Out node Add option for XAouth2 for SMTP node * XOAUTH2 SMTP Exposing functionality for OAuth2 through Nodemailer. Added some error reporting if credentials are missing to match the Email-In node. * XOAUTH2 SMTP Release Updated help file to reflect changes. * Unit Tests for Email Out Modified tests to allow these unit tests to pass, but does not address the fault caused by the Node Test Helper - credentials only loaded after the flow has been loaded. --------- Co-authored-by: Dave Conway-Jones <dceejay@users.noreply.github.com>
2023-03-27 21:27:47 +02:00
$(".node-input-password").show();
$(".node-input-saslformat").hide();
$(".node-input-token").hide();
} else if (protocol === "NONE") {
$(".node-input-userid").hide();
$(".node-input-password").hide();
$(".node-input-saslformat").hide();
$(".node-input-token").hide();
}
else {
$(".node-input-userid").show();
XOAuth2 for Email-In node (#975) * Update PULL_REQUEST_TEMPLATE.md * Add new UI elements to Email In node Locale for en-US Added Auth type and Token field to Email IN Dynamically appear based on selection * XOAUTH2 IMAP Minor UI changes. Exposing only XOAuth2. Picks up raw access token from input message specified. Only works for IMAP Token formatted by node for Exchange and GMail, won't work on other providers. Only works on trigger, not timer TODO: Add POP XOAUTH2 capability Add SMTP XOAUTH2 capability Add option to pass SASL XAOUTH2 token rather than raw OAUTH2 token * SASL Format Added checkbox to turn off SASL formatting if the user wants to do this themselves * XOAuth2 forces input Using XOauth2 forces triggered node, and automatic trigger sets auth to basic; XOAuth2 needs token from flow * Error reporting Password missing error only occurs if set to basic authentication. Token missing only occurs if set to XOAuth2. * Unit tests Make sure basic authentication is selected by default, and that an additional input is created and timed triggers are turned off for XOauth2 * Cleanup and README Remove old code, update readme * XOauth2 IMAP Release Prevent XOAuth2 being used for POP. Update PR Template. Updated help file. Bumped version to 1.19-beta * Update POP3 dependency Removed dependency to poplib.js, moved to node-pop3. Re-wrote checkPOP3 function asynchronously using the new library. Added some node.status changes to mimic IMAP behaviour. * XOAUTH2 POP3 Added checking for authentication type to allow XOauth2 tokens to be sent to POP server. Turned off UI restrictions for this functionality. * XOAUTH2 POP3 Release Updated help docs and version to reflect changes. * Add new UI elements to Email Out node Add option for XAouth2 for SMTP node * XOAUTH2 SMTP Exposing functionality for OAuth2 through Nodemailer. Added some error reporting if credentials are missing to match the Email-In node. * XOAUTH2 SMTP Release Updated help file to reflect changes. * Unit Tests for Email Out Modified tests to allow these unit tests to pass, but does not address the fault caused by the Node Test Helper - credentials only loaded after the flow has been loaded. --------- Co-authored-by: Dave Conway-Jones <dceejay@users.noreply.github.com>
2023-03-27 21:27:47 +02:00
$(".node-input-password").hide();
$(".node-input-saslformat").show();
$(".node-input-token").show();
$("#node-input-fetch").val("trigger");
$("#node-input-fetch").change();
}
});
</script>
</script>
<script type="text/javascript">
(function() {
RED.nodes.registerType('e-mail in',{
category: 'social-input',
color:"#c7e9c0",
defaults: {
name: {value:""},
protocol: {value: "IMAP", required:true}, // Which protocol to use to connect to the mail server ("IMAP" or "POP3")
server: {value:"imap.gmail.com",required:true},
useSSL: {value: true},
autotls: {value: "never"},
port: {value:"993",required:true},
XOAuth2 for Email-In node (#975) * Update PULL_REQUEST_TEMPLATE.md * Add new UI elements to Email In node Locale for en-US Added Auth type and Token field to Email IN Dynamically appear based on selection * XOAUTH2 IMAP Minor UI changes. Exposing only XOAuth2. Picks up raw access token from input message specified. Only works for IMAP Token formatted by node for Exchange and GMail, won't work on other providers. Only works on trigger, not timer TODO: Add POP XOAUTH2 capability Add SMTP XOAUTH2 capability Add option to pass SASL XAOUTH2 token rather than raw OAUTH2 token * SASL Format Added checkbox to turn off SASL formatting if the user wants to do this themselves * XOAuth2 forces input Using XOauth2 forces triggered node, and automatic trigger sets auth to basic; XOAuth2 needs token from flow * Error reporting Password missing error only occurs if set to basic authentication. Token missing only occurs if set to XOAuth2. * Unit tests Make sure basic authentication is selected by default, and that an additional input is created and timed triggers are turned off for XOauth2 * Cleanup and README Remove old code, update readme * XOauth2 IMAP Release Prevent XOAuth2 being used for POP. Update PR Template. Updated help file. Bumped version to 1.19-beta * Update POP3 dependency Removed dependency to poplib.js, moved to node-pop3. Re-wrote checkPOP3 function asynchronously using the new library. Added some node.status changes to mimic IMAP behaviour. * XOAUTH2 POP3 Added checking for authentication type to allow XOauth2 tokens to be sent to POP server. Turned off UI restrictions for this functionality. * XOAUTH2 POP3 Release Updated help docs and version to reflect changes. * Add new UI elements to Email Out node Add option for XAouth2 for SMTP node * XOAUTH2 SMTP Exposing functionality for OAuth2 through Nodemailer. Added some error reporting if credentials are missing to match the Email-In node. * XOAUTH2 SMTP Release Updated help file to reflect changes. * Unit Tests for Email Out Modified tests to allow these unit tests to pass, but does not address the fault caused by the Node Test Helper - credentials only loaded after the flow has been loaded. --------- Co-authored-by: Dave Conway-Jones <dceejay@users.noreply.github.com>
2023-03-27 21:27:47 +02:00
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
criteria: {value: "UNSEEN"},
repeat: {value:"300",required:true},
fetch: {value:"auto"},
inputs: {value:0}
},
credentials: {
userid: {type:"text"},
password: {type: "password"},
global: { type:"boolean"}
},
inputs: 0,
outputs: 1,
icon: "envelope.png",
paletteLabel: function() {
2018-04-14 23:43:14 +02:00
return this._("email.email");
},
label: function() {
return this.name||this._("email.email");
},
labelStyle: function() {
return (this.name)?"node_label_italic":"";
},
oneditprepare: function() {
var that = this;
if (this.authtype === undefined) {
this.authtype = "BASIC";
$("#node-input-authtype").val('BASIC');
}
if (this.credentials.global) {
$('#node-tip').show();
} else {
$('#node-tip').hide();
}
if (typeof this.box === 'undefined') {
$("#node-input-box").val("INBOX");
this.box = "INBOX";
}
2019-02-11 21:10:31 +01:00
if (typeof this.criteria === 'undefined') {
$("#node-input-criteria").val("UNSEEN");
this.criteria = "UNSEEN";
}
2021-04-15 11:32:40 +02:00
if (typeof this.autotls === 'undefined') {
$("#node-input-autotls").val("never");
this.autotls = "never";
}
if ($("#node-input-fetch").val() === null) { $("#node-input-fetch").val("auto"); }
$("#node-input-fetch").change(function() {
if ($("#node-input-fetch").val() === "trigger") {
$('#node-repeatTime').hide();
that.inputs = 1;
}
else {
$('#node-repeatTime').show();
that.inputs = 0;
XOAuth2 for Email-In node (#975) * Update PULL_REQUEST_TEMPLATE.md * Add new UI elements to Email In node Locale for en-US Added Auth type and Token field to Email IN Dynamically appear based on selection * XOAUTH2 IMAP Minor UI changes. Exposing only XOAuth2. Picks up raw access token from input message specified. Only works for IMAP Token formatted by node for Exchange and GMail, won't work on other providers. Only works on trigger, not timer TODO: Add POP XOAUTH2 capability Add SMTP XOAUTH2 capability Add option to pass SASL XAOUTH2 token rather than raw OAUTH2 token * SASL Format Added checkbox to turn off SASL formatting if the user wants to do this themselves * XOAuth2 forces input Using XOauth2 forces triggered node, and automatic trigger sets auth to basic; XOAuth2 needs token from flow * Error reporting Password missing error only occurs if set to basic authentication. Token missing only occurs if set to XOAuth2. * Unit tests Make sure basic authentication is selected by default, and that an additional input is created and timed triggers are turned off for XOauth2 * Cleanup and README Remove old code, update readme * XOauth2 IMAP Release Prevent XOAuth2 being used for POP. Update PR Template. Updated help file. Bumped version to 1.19-beta * Update POP3 dependency Removed dependency to poplib.js, moved to node-pop3. Re-wrote checkPOP3 function asynchronously using the new library. Added some node.status changes to mimic IMAP behaviour. * XOAUTH2 POP3 Added checking for authentication type to allow XOauth2 tokens to be sent to POP server. Turned off UI restrictions for this functionality. * XOAUTH2 POP3 Release Updated help docs and version to reflect changes. * Add new UI elements to Email Out node Add option for XAouth2 for SMTP node * XOAUTH2 SMTP Exposing functionality for OAuth2 through Nodemailer. Added some error reporting if credentials are missing to match the Email-In node. * XOAUTH2 SMTP Release Updated help file to reflect changes. * Unit Tests for Email Out Modified tests to allow these unit tests to pass, but does not address the fault caused by the Node Test Helper - credentials only loaded after the flow has been loaded. --------- Co-authored-by: Dave Conway-Jones <dceejay@users.noreply.github.com>
2023-03-27 21:27:47 +02:00
$("#node-input-authtype").val("BASIC");
$("#node-input-authtype").change();
}
});
$("#node-input-criteria").change(function() {
if ($("#node-input-criteria").val() === "_msg_") {
$("#node-input-fetch").val("trigger");
$("#node-input-fetch").change();
}
});
XOAuth2 for Email-In node (#975) * Update PULL_REQUEST_TEMPLATE.md * Add new UI elements to Email In node Locale for en-US Added Auth type and Token field to Email IN Dynamically appear based on selection * XOAUTH2 IMAP Minor UI changes. Exposing only XOAuth2. Picks up raw access token from input message specified. Only works for IMAP Token formatted by node for Exchange and GMail, won't work on other providers. Only works on trigger, not timer TODO: Add POP XOAUTH2 capability Add SMTP XOAUTH2 capability Add option to pass SASL XAOUTH2 token rather than raw OAUTH2 token * SASL Format Added checkbox to turn off SASL formatting if the user wants to do this themselves * XOAuth2 forces input Using XOauth2 forces triggered node, and automatic trigger sets auth to basic; XOAuth2 needs token from flow * Error reporting Password missing error only occurs if set to basic authentication. Token missing only occurs if set to XOAuth2. * Unit tests Make sure basic authentication is selected by default, and that an additional input is created and timed triggers are turned off for XOauth2 * Cleanup and README Remove old code, update readme * XOauth2 IMAP Release Prevent XOAuth2 being used for POP. Update PR Template. Updated help file. Bumped version to 1.19-beta * Update POP3 dependency Removed dependency to poplib.js, moved to node-pop3. Re-wrote checkPOP3 function asynchronously using the new library. Added some node.status changes to mimic IMAP behaviour. * XOAUTH2 POP3 Added checking for authentication type to allow XOauth2 tokens to be sent to POP server. Turned off UI restrictions for this functionality. * XOAUTH2 POP3 Release Updated help docs and version to reflect changes. * Add new UI elements to Email Out node Add option for XAouth2 for SMTP node * XOAUTH2 SMTP Exposing functionality for OAuth2 through Nodemailer. Added some error reporting if credentials are missing to match the Email-In node. * XOAUTH2 SMTP Release Updated help file to reflect changes. * Unit Tests for Email Out Modified tests to allow these unit tests to pass, but does not address the fault caused by the Node Test Helper - credentials only loaded after the flow has been loaded. --------- Co-authored-by: Dave Conway-Jones <dceejay@users.noreply.github.com>
2023-03-27 21:27:47 +02:00
$("#node-input-token").typedInput({
type:'msg',
types:['msg']
});
}
});
})();
</script>
2020-10-19 13:24:18 +02:00
<script type="text/html" data-template-name="e-mail mta">
<div class="form-row">
<label for="node-input-port"><i class="fa fa-random"></i> <span data-i18n="email.label.port"></span></label>
<input type="text" id="node-input-port" style="width:100px">
<label style="width:40px"> </label>
<input type="checkbox" id="node-input-secure" style="display:inline-block; width:20px; vertical-align:baseline;">
<span data-i18n="email.label.enableSecure"></span>
</div>
<div class="form-row">
<label for="node-input-starttls"><i class="fa fa-lock"></i> <span data-i18n="email.label.enableStarttls"></span></label>
<input type="checkbox" id="node-input-starttls" style="display:inline-block; width:20px; vertical-align:baseline;">
<span data-i18n="email.label.starttlsUpgrade"></span>
</div>
<div class="form-row" id="certRow">
<label for="node-input-certFile"><i class="fa fa-file"></i>
<span data-i18n="email.label.certFile"></span></label>
<input type="text" id="node-input-certFile" placeholder="server.crt" style="width:100%">
</div>
<div class="form-row" id="keyRow">
<label for="node-input-keyFile"><i class="fa fa-key"></i>
<span data-i18n="email.label.keyFile"></span></label>
<input type="text" id="node-input-keyFile" placeholder="private.key" style="width:100%">
</div>
<div class="form-row">
<label for="node-input-auth"><i class="fa fa-user"></i> <span data-i18n="email.label.users"></span></label>
<input type="checkbox" id="node-input-auth" style="display:inline-block; width:20px; vertical-align:baseline;">
<span data-i18n="email.label.auth"></span>
</div>
<div class="form-row node-input-email-users-container-row" style="margin-bottom: 0px;">
<div id="node-input-email-users-container-div" style="box-sizing: border-box; border-radius: 5px;
height: 200px; padding: 5px; border: 1px solid #ccc; overflow-y:scroll;">
<ol id="node-input-email-users-container" style="list-style-type:none; margin: 0;"></ol>
</div>
2020-10-19 13:24:18 +02:00
</div>
<div class="form-row">
<a href="#" class="editor-button editor-button-small" id="node-input-email-users-add" style="margin-top: 4px;">
<i class="fa fa-plus"></i>
<span data-i18n="email.label.addButton"></span>
</a>
</div>
<div class="form-row">
<label for="node-input-expert"><i class="fa fa-cog"></i> <span data-i18n="email.label.expert"></span></label>
<input type="text" id="node-input-expert">
</div>
2020-10-19 13:24:18 +02:00
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="node-red:common.label.name"></span></label>
<input type="text" id="node-input-name" data-i18n="[placeholder]node-red:common.label.name">
</div>
<div class="form-tips" id="node-tip"><span data-i18n="[html]email.tip.mta"></span></div>
</script>
<script type="text/javascript">
RED.nodes.registerType('e-mail mta', {
2020-10-19 13:24:18 +02:00
category: 'social',
color: "#c7e9c0",
2020-10-19 13:24:18 +02:00
defaults: {
name: { value: "" },
port: { value: "1025", required: true, validate: RED.validators.number() },
secure: { value: false },
starttls: { value: false },
certFile: { value: "" },
keyFile: { value: "" },
users: { value: [] },
auth: { value: false },
expert: { value: '{"logger":false}' }
2020-10-19 13:24:18 +02:00
},
inputs: 0,
outputs: 1,
2020-10-19 13:24:18 +02:00
icon: "envelope.png",
paletteLabel: function () { return this._("email.email") + " MTA" },
label: function () {
return this.name || this._("email.email") + " MTA";
2020-10-19 13:24:18 +02:00
},
labelStyle: function () {
return this.name ? "node_label_italic" : "";
},
oneditprepare: function () {
let node = this;
// Certificate settings
$("#node-input-secure").change(secVisibility);
$("#node-input-starttls").change(secVisibility);
function secVisibility() {
if ($("#node-input-secure").is(":checked") || $("#node-input-starttls").is(":checked")) {
$("#certRow").show();
$("#keyRow").show();
} else {
$("#certRow").hide();
$("#keyRow").hide();
}
}
// User Management
let cacheItemCount = 0;
if (node.users && node.users.length > 0) {
cacheItemCount = node.users.length;
node.users.forEach(function (element, index, array) {
generateUserEntry(element, index);
});
}
function generateUserEntry(user, id) {
let container = $("<li/>", {
style: "background: #fefefe; margin:0; padding:8px 0px; border-bottom: 1px solid #ccc;"
});
let row = $('<div id="row' + id + '"/>').appendTo(container);
$('<i style="color: #eee; cursor: move;" class="node-input-email-users-handle fa fa-bars"></i>').appendTo(row);
let userField = $("<input/>", {
id: "node-input-email-users-name" + id,
class: "userName",
type: "text",
style: "margin-left:5px;width:100px;",
placeholder: "name"
}).appendTo(row);
let passwordField = $("<input/>", {
id: "node-input-email-users-password" + id,
class: "userPassword",
type: "password",
style: "margin: 0 auto;width:50%;min-width:20px;margin-left:5px",
placeholder: "password"
}).appendTo(row);
userField.val(user.name);
passwordField.val(user.password);
let finalspan = $("<span/>", {
style: "float: right;margin-right: 10px;"
}).appendTo(row);
let removeUserButton = $("<a/>", {
href: "#",
id: "node-button-user-remove" + id,
class: "editor-button editor-button-small",
style: "margin-top: 7px; margin-left: 5px;"
}).appendTo(finalspan);
$("<i/>", { class: "fa fa-remove" }).appendTo(removeUserButton);
removeUserButton.click(function () {
container.css({ background: "#fee" });
container.fadeOut(300, function () {
$(this).remove();
});
});
$("#node-input-email-users-container").append(container);
}
$("#node-input-email-users-container").sortable({
axis: "y",
handle: ".node-input-email-users-handle",
cursor: "move"
});
$("#node-input-email-users-container .node-input-email-users-handle").disableSelection();
$("#node-input-email-users-add").click(function () {
if (!cacheItemCount || cacheItemCount < 0) {
cacheItemCount = 0;
}
generateUserEntry({ name: "", password: "" }, cacheItemCount++);
$("#node-input-email-users-container-div").scrollTop(
$("#node-input-email-users-container-div").get(0).scrollHeight
);
});
$("#node-input-auth").change(function () {
if ($("#node-input-auth").is(":checked")) {
$("#node-input-email-users-add").show();
$("#node-input-email-users-container-div").show();
} else {
$("#node-input-email-users-add").hide();
$("#node-input-email-users-container-div").hide();
}
});
// Expert settings
$("#node-input-expert").typedInput({
type: "json",
types: ["json"]
})
},
oneditsave: function () {
let node = this;
let cacheUsers = $("#node-input-email-users-container").children();
node.users = [];
cacheUsers.each(function () {
node.users.push({
name: $(this)
.find(".userName")
.val(),
password: $(this)
.find(".userPassword")
.val()
});
});
2020-10-19 13:24:18 +02:00
}
});
</script>