node-red-nodes
node-red-nodes copied to clipboard
Attachment Text states "File from Node-RED is attached" needs to be configurable
Sending an attachment forces the label "File from Node-RED is attached". Other people have raised this on the Node-Red forums. It's a show stopper using this library forcing to show such labels isn't always ideal.
- Either want no attachment text so set to msg.attachmenttext="";
- Something custom set to say msg.attachmenttext = "See latest attachment"
- then Default to File from Node-RED is attached
Please use the full template that you were shown when you opened the issue, it gathers a bunch of information that we need to work on a problem. e.g. the node name and version you are using
I'm going to assume you mean the node-red-node-email node here?
You can get the effect you want just by using some of the other attachment methods e.g. and input message as follows:
{
topic: "subject",
payload: "Your message here",
attachments: [
{
filename: "test.txt",
content: "HelloWorld"
}
]
}
So if needed you can use a change node or function node to move the buffer payload to an attachements array with a filename, then you can set payload to anything you want (but it has to be present so setting it to "" for empty)
Did you try msg.description as per the info sidebar ?
Did you try msg.description as per the info sidebar ?
yes mate I did , no success it puts the description in the email body but still has File from Node-RED is attached included. Thanks kindly for your suggestion :-)
So why is this a show stopper ?
And have you tried the method I suggested?
Indeed the correct method is as per @hardillb - the other is just a convenience.
So why is this a show stopper ?
i've looked at the code of the build and the NODE-RED attachment statement is hardcoded by default, secondly the proposed solution which I will try (and Ben thanks for your kind input on that - I will try this over the next few days), I'm actually writing a complex transcoder from one AI model to another, generating multiple file assets. Putting them into a buffer as recommended for multiple file attachment and then add them into an array of attachments (with own payload) as I create them, then finally into a single zip file (using zip node) as the last task before creating email attachment and sending. All works great then I get the message FILE FROM NODE-RED is attached and tried all ways to remove it. Did not expect stuff to be hard coded in this library as its clearly there.
I will share more info later if I struggle to remove this from Ben's recommendation. Many thanks for the kind responses and support. Very much appreciated folks!
I did not like the tag line "File from Node-RED is attached" either. I found in file C:\Users\USERNAME.node-red\node_modules\node-red-node-email\locales\en-US\61-email.json
on mine it was line 48
"default-message": "description\n\nFile from Node-RED is attached: filename"
It is only hard-coded if you send a binary buffer payload and no other options. If you declare the msg object as Ben describes above the plain text msg.payload will become your message instead.