Help with multiple lines on inject node

Hi again,
I'm working on a system which extracts info from an email and triggers events based on the input.
all the hard part is done regarding regex etc, as I originally built this outside of node red.

Now that I'm transporting it all over to node red, I need to use the inject node to test things are working as it'll be a pain to keep triggering the cameras.

I was hoping to copy the below text onto an inject node and go from there, but it imports it all as one line which doesn't work with my regex expressions.

I've tried adding '\n' in the place of where a new line should be, but that doesn't work either.

Please could someone advise how to get the exact below text into a manually injectable msg object?

P.S I can't just email node red from my email account as the NVR is on the local network and the node-red instance can't access external emails.

This is an automatically generated e-mail from your NVR.

EVENT TYPE: intrusion
EVENT TIME: 2022-10-19,15:35:34
NVR NAME: Tube NVR
NVR S/N: 123456789123456789123456789
CAMERA NAME(NUM): Carpark TWDS That RD(D2) Carpark Pole(D4) Pole TWDS Warehouse(D8) Pole PTZ 1(D12)

Thank you in advance!

The quick solution is to add a template node after the inject node to add this to the passing message.

connect the inject node to a template node. In this example I pass the time and serial number in from the inject node

[{"id":"fe07b0946175a431","type":"inject","z":"ca10d8b42460becc","name":"","props":[{"p":"payload"},{"p":"serialnum","v":"123456789123456789123456789","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":320,"y":440,"wires":[["72b312bfe8a50d44"]]},{"id":"aa4758a6a244be71","type":"debug","z":"ca10d8b42460becc","name":"debug 10","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":680,"y":440,"wires":[]},{"id":"72b312bfe8a50d44","type":"template","z":"ca10d8b42460becc","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"This is an automatically generated e-mail from your NVR.\n\nEVENT TYPE: intrusion EVENT TIME: {{payload}}\nNVR NAME: Tube NVR NVR S/N: {{serialnum}}\nCAMERA NAME(NUM): Carpark TWDS That RD(D2) Carpark Pole(D4) Pole TWDS Warehouse(D8) Pole PTZ 1(D12)","output":"str","x":500,"y":440,"wires":[["aa4758a6a244be71"]]}]

This works perfectly. Thank you so much. I appreciate it!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.