mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
add option to set criteria witch type of emails should be requested (#519)
This commit is contained in:
parent
31b9cc1f61
commit
aa684240d8
@ -57,6 +57,7 @@
|
|||||||
<label for="node-input-dname"><i class="fa fa-tag"></i> <span data-i18n="node-red:common.label.name"></span></label>
|
<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">
|
<input type="text" id="node-input-dname" data-i18n="[placeholder]node-red:common.label.name">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-tips" id="node-tip"><span data-i18n="[html]email.tip.cred"></span></div>
|
<div class="form-tips" id="node-tip"><span data-i18n="[html]email.tip.cred"></span></div>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -171,6 +172,27 @@
|
|||||||
<option value="Delete" data-i18n="email.label.delete"></option>
|
<option value="Delete" data-i18n="email.label.delete"></option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-input-criteria"><i class="fa fa-criteria"></i> <span data-i18n="node-red:common.label.criteria"></span></label>
|
||||||
|
<select type="text" id="node-input-criteria">
|
||||||
|
<option value="ALL" selected="selected" data-i18n="email.label.all"></option>
|
||||||
|
<option value="ANSWERED" data-i18n="email.label.answered"></option>
|
||||||
|
<option value="FLAGGED" data-i18n="email.label.flagged"></option>
|
||||||
|
<option value="SEEN" selected="selected" data-i18n="email.label.seen"></option>
|
||||||
|
<option value="UNANSWERED" selected="selected" data-i18n="email.label.unanswered"></option>
|
||||||
|
<option value="UNFLAGGED" selected="selected" data-i18n="email.label.unflagged"></option>
|
||||||
|
<option value="UNSEEN" data-i18n="email.label.unseen"></option>
|
||||||
|
<!--
|
||||||
|
<option value="DELETED" data-i18n="email.label.delete"></option>
|
||||||
|
<option value="DRAFT" selected="selected" 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/>
|
<br/>
|
||||||
<div class="form-row">
|
<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>
|
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="node-red:common.label.name"></span></label>
|
||||||
@ -199,9 +221,11 @@
|
|||||||
if (protocol === "IMAP") {
|
if (protocol === "IMAP") {
|
||||||
$(".node-input-box").show();
|
$(".node-input-box").show();
|
||||||
$(".node-input-disposition").show();
|
$(".node-input-disposition").show();
|
||||||
|
$(".node-input-criteria").show();
|
||||||
} else {
|
} else {
|
||||||
$(".node-input-box").hide();
|
$(".node-input-box").hide();
|
||||||
$(".node-input-disposition").hide();
|
$(".node-input-disposition").hide();
|
||||||
|
$(".node-input-criteria").hide();
|
||||||
}
|
}
|
||||||
checkPorts();
|
checkPorts();
|
||||||
});
|
});
|
||||||
@ -252,6 +276,7 @@
|
|||||||
port: {value:"993",required:true},
|
port: {value:"993",required:true},
|
||||||
box: {value:"INBOX"}, // For IMAP, The mailbox to process
|
box: {value:"INBOX"}, // For IMAP, The mailbox to process
|
||||||
disposition: { value: "Read" }, // For IMAP, the disposition of the read email
|
disposition: { value: "Read" }, // For IMAP, the disposition of the read email
|
||||||
|
criteria: {value: "UNSEEN"},
|
||||||
repeat: {value:"300",required:true},
|
repeat: {value:"300",required:true},
|
||||||
fetch: {value:"auto"},
|
fetch: {value:"auto"},
|
||||||
inputs: {value:0}
|
inputs: {value:0}
|
||||||
|
@ -160,6 +160,7 @@ module.exports = function(RED) {
|
|||||||
this.useSSL= n.useSSL;
|
this.useSSL= n.useSSL;
|
||||||
this.protocol = n.protocol || "IMAP";
|
this.protocol = n.protocol || "IMAP";
|
||||||
this.disposition = n.disposition || "None"; // "None", "Delete", "Read"
|
this.disposition = n.disposition || "None"; // "None", "Delete", "Read"
|
||||||
|
this.criteria = n.criteria || "UNSEEN"; // "ALL", "ANSWERED", "FLAGGED", "SEEN", "UNANSWERED", "UNFLAGGED", "UNSEEN"
|
||||||
|
|
||||||
var flag = false;
|
var flag = false;
|
||||||
|
|
||||||
@ -343,7 +344,7 @@ module.exports = function(RED) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
imap.search([ 'UNSEEN' ], function(err, results) {
|
imap.search([ this.criteria ], function(err, results) {
|
||||||
if (err) {
|
if (err) {
|
||||||
node.status({fill:"red", shape:"ring", text:"email.status.foldererror"});
|
node.status({fill:"red", shape:"ring", text:"email.status.foldererror"});
|
||||||
node.error(RED._("email.errors.fetchfail", {folder:node.box}),err);
|
node.error(RED._("email.errors.fetchfail", {folder:node.box}),err);
|
||||||
|
@ -20,7 +20,15 @@
|
|||||||
"disposition": "Disposition",
|
"disposition": "Disposition",
|
||||||
"none": "None",
|
"none": "None",
|
||||||
"read": "Mark Read",
|
"read": "Mark Read",
|
||||||
"delete": "Delete"
|
"delete": "Delete",
|
||||||
|
"criteria": "Criteria",
|
||||||
|
"all": "All",
|
||||||
|
"answered": "Answered",
|
||||||
|
"flagged": "Flagged",
|
||||||
|
"seen": "Seen",
|
||||||
|
"unanswered": "Unanswered",
|
||||||
|
"unflagged": "Unflagged",
|
||||||
|
"unseen": "Unseen"
|
||||||
},
|
},
|
||||||
"default-message": "__description__\n\nFile from Node-RED is attached: __filename__",
|
"default-message": "__description__\n\nFile from Node-RED is attached: __filename__",
|
||||||
"tip": {
|
"tip": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user