Send an email once a day

Hi,
I am trying to send an email once a day using the trigger node but it is not working, is the trigger node able to do this without an input or does it require an inject node to start it off and if that is the case do I have to start it with a click to the inject node every time the system has been off ?

Thanks
Stuart

Inject nodes is what you need with a suitable setting for the time you want it to occur (see the settings on the inject node at the bottom regarding timing)

Alternatively, you can install the highly customisable node-red-contrib-cron-plus for much greater control.

1 Like

The way you have the trigger node set up it will send the first message it receives (eg from an inject), then nothing for 24 hours, then one more message.
After that another incoming message will be sent on straight away and reset the trigger.

So it would be possible to have a message passed on at
25-06-2025 00:00:01, then resent at
26-06-2025 00:00:01, and if a new message arrives at
26-06-2025 01:05:00 and then it's resent at
27-06-2025 01:05:00.

There is an option in the trigger node to resend every 24 hours

However, you might end up with multiple parallel message queues waiting their own 24 hour period. To avoid it you could set msg.reset in each incoming message.

I think the queued message would be lost in the event of a deploy or Node-red restart.

Depending on the data you are emailing it's probably simpler to have an inject node set to fire at a specific time every day.

1 Like

Hi Jbudd,
I have no incoming message, basically I have a formatted email with the contents of global variables, so it sends the current temperatures via email, I just need to automate sending them

Thanks
Stuart

Hi,
I have tried an inject node, however it sends emails every time I do a deploy so I guess it is starting a fresh ?

Thanks
Stuart

Umm.
Well the temperature data arrives in Node-red somehow.

Use an inject node eg set to fire at 14:00 every day, or cron-plus. This is not "every 24 hours"

There are other solutions but the two above will work regardless of deploy/reboot, so long as the device is running at the inject time.

Because you have "inject once after 0.1 seconds" ticked.

also, you are probably doing a "FULL deploy" instead of "CHANGED NODES ONLY deploy" - that causes all nodes to be destroyed and recreated (and therefore inject triggers again)

If you use "CHANGED NODES ONLY deploy" or disable "inject once after 0.1 seconds" or use cron-plus this wont happen

1 Like

Hi Steve,

Thanks for the info, I have de checked the inject after box and will see how it goes, also the Deploy info was much appreciated, I will try and get my head around cron plus too as it looks like it can do a lot.

Thanks
Stuart

Hi,

I found a great video on youtube that explains cron syntax which is really informative, I am now using cron plus for my shedule.

Thanks
Stuart