Hi, I've been reading some threads in the forum but I cannot find a way to use msg/payload values inside attachments filename and content... I'm using as reference some threads from forum, and nodemailer info.
I'm trying to use payload contents to define atachment name and content, this is part if the payload arriving to function node that is injected into email node:
If I try with other payload parts in the filename, it works... for example with _msgid value... but when I try to a value inside the  it doesnt:
I guess there is other way to call that value inside function but I cannot manage to find
And regarding the content, maybe is not so simple to call the buffer coming from payload? It seems to come in "raw" format
How can I do that?
In any case why there would not be there? this is the debug of msg.payload of the node injecting into email node:
If I use in filename something like msg._msgid... it works, and uses for file name that 2e97...etc, but when I use other deeper data as I tried above it doesn work. Is there any different way to call arrays of objects in a function?
Add `node.warn(msg.payload.adjunto) to the top of the function node and see if you get an error from that line and check the output in the debug side panel (or the node-red log if you prefer).
No idea, but the error is clear. Whenever I've had issues like that in the past, it was either because I mistyped the property name or I got a message that didn't actually have the data I thought it did.
Not really but then it isn't actually the array part that you are getting an error for, it is the property name itself. It doesn't think that property exists (undefined) so it can't give you the first element. Which is why I suggest putting in an extra statement to check.
Thought of one other possibility, that the property you think is named adjunto might have a non-printable character on it - or maybe has an extended character - somthing that isn't getting printed but that exists anyway? Still, the warn output is the first check.
You're right about that variables... I don;t know why but even appearing on the debug they were not really arriving to function node (nothing inside payload), only the objects in the root, so I managed to change its value to something different than inside payload before join node:
And now, the function node that is after the join node received this ok. I did same with buffer, changing payload to msg.buffer... and now both are fine used by function node.
I will try to see why this was happening... but at least it works, thanks @TotallyInformation
Just for anyone else to now that it works as it was intended to:), i leave here function node for mail attachment now without the payload related ones that I'm using now:
Hi, yes it was with Output Complete Message because I needed to debug the buffer somehow, that they was I was getting the file to later be attached in the email.
This is coming from a Join node, that gets 3 things: email body and subject, attachment name, and attachment content (in buffer it seems, thats all i get). Then after this Join node it goes to the Function node i showed above... and then to email node.
The thing is that the debug node i was using was showing some payload info that... was not really there, I dont know why. I may have a poltergeist with several stuff via Join nodes... it works... but I still dont know why it wasnt the other way :(...