Email logged file

Hi All,

I have node red collecting data from a USB serial port. The data comes in, gets a timestamp added to it and then sent onto a log file on the Raspberry Pi desktop.

I would like Nodered to then automatically email the stored log file every 6 hours to a pre-set email address. I can get Nodered to send emails just fine but cannot for the life of me work out how to send the log file!

Thanks for the help.

Nick

Well the info on the right should help you... it points to creating a msg.attachments array pointing at the file. A function like this

msg.attachments = [
    {   
        filename: 'yourfile.log',
        path: '/path/to/yourfile.log' 
    }
];

Thanks for the help! Still struggling though, i have no idea how to do this.

Do I put the function node you mentioned before or after log file node?

I cant believe its so hard to send an automatic email of a log file a few times a day!

Many thanks

Nick

after the file log node would be best.
If you are able to share your flow file it would be easier to advise.

Thanks - heres the pic.
The function node in between the serial port and the log simply adds a timestamp.
Thanks

Nick

I was thinking more the actual flow file