1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

email optionally uses criteria from message (#547)

* email optionally uses criteria from message

Allows for generation of detailed queries through flows when triggering an email
fetch in IMAP.

* use the same default as a new email node

When the criteria is set from a message, if there is no criteria use the same default as a new node.
This commit is contained in:
Luis Mario Domenzain 2019-05-29 13:45:54 +02:00 committed by Dave Conway-Jones
parent 877763aae9
commit 16130362fc
5 changed files with 9 additions and 3 deletions

View File

@ -182,6 +182,7 @@
<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>
<option value="DRAFT" data-i18n="email.label.none"></option>

View File

@ -352,7 +352,10 @@ module.exports = function(RED) {
return;
}
else {
imap.search([ node.criteria ], function(err, results) {
var criteria = ((node.criteria === '_msg_')?
(msg.criteria || ["UNSEEN"]):
([node.criteria]));
imap.search(criteria, function(err, results) {
if (err) {
node.status({fill:"red", shape:"ring", text:"email.status.foldererror"});
node.error(RED._("email.errors.fetchfail", {folder:node.box}),err);

View File

@ -22,6 +22,7 @@
"read": "Mark Read",
"delete": "Delete",
"criteria": "Criteria",
"criteriaFromMsg": "- set from msg.criteria -",
"all": "All",
"answered": "Answered",
"flagged": "Flagged",

View File

@ -15,7 +15,8 @@
"disposition": "受信後の処理",
"none": "なし",
"read": "既読",
"delete": "削除"
"delete": "削除",
"criteriaFromMsg": "- msg.criteriaから使用 -"
},
"default-message": "__description__\n\nNode-REDからファイルが添付されました: __filename__",
"tip": {

View File

@ -1,6 +1,6 @@
{
"name": "node-red-node-email",
"version": "1.5.2",
"version": "1.6.0",
"description": "Node-RED nodes to send and receive simple emails",
"dependencies": {
"imap": "^0.8.19",