I have two flows using the node-red-node-email
node in Node-RED.
The first one uses predefined value for fetching all emails (Criteria: All). It works properly and fetches two emails I have in my Inbox:
The second one should emulate the same, but thru specifying msg.criteria
:
I created a flow with a change
node setting the value.
The info page for the email module refers to a doc page for another module and does not give a clear example, but I assumed I should add a string value of [ ALL ]
. Here's the relevant part of the change
module:
"rules": [
{
"t": "set",
"p": "criteria",
"pt": "msg",
"to": "[ 'ALL' ]",
"tot": "str"
}
In result the email node changes to connecting
then to fetching
and remains in this state. The Node-RED web server does not respond for a while.
I also tried specifying msg.criteria
as a JSON object the following way (in result I get an "Invalid 'to' JSON property"
in debug):
"rules": [
{
"t": "set",
"p": "criteria",
"pt": "msg",
"to": "[ 'ALL' ]",
"tot": "json"
}
],
or the following way (in result I have no response at all; the email node does not even go to connecting
state):
"rules": [
{
"t": "set",
"p": "criteria",
"pt": "msg",
"to": "{ [ 'ALL' ] }",
"tot": "json"
}
],
What type should msg.criteria
be and what data should it contain to fetch all emails (and by extension other criteria)?
As I mentioned in my second comment, this is most likely to do with how you set up the change node with the JSON array.
The following change node config works as expected.
Note that ALL
is wrapped with double quotes, not single quotes. This is important as the Change node throws an error when single quotes are set and doesn't actually add the field to the msg
object.