# Sending Emails on specific dates

**URL:** https://discourse.nodered.org/t/sending-emails-on-specific-dates/78744
**Category:** General
**Created:** [27 May 2023 22:10 UTC](https://discourse.nodered.org/t/sending-emails-on-specific-dates/78744 "2023-05-27T22:10:57Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![snowmansmartie](https://avatars.discourse-cdn.com/v4/letter/s/c77e96/32.png) [@snowmansmartie](https://discourse.nodered.org/u/snowmansmartie)
#### Post date: [27 May 2023 22:10 UTC](https://discourse.nodered.org/t/sending-emails-on-specific-dates/78744/1 "2023-05-27T22:10:57Z")

</div>

Hi guys,

I'm very new to Node-Red and using it within Home Assistant. I am wanting to setup an automated Email that gets sent on a specific calculated day every month. I will try and break this down the best I can:

Email needs to get sent 10 working days before the same day a month later  
Email cannot be sent on a weekend or a public UK holiday

So for example if the last Email sent was on the 20/04/2023, the next Email would need to be sent on the 5/05/2023. This is because the 20/05 is a Saturday, so 10 working days (Mon to Fri) would be the 8th, but the 8th is a Bank Holiday so cant be sent then either, so would then need to be sent on the Friday prior being the 5th.

I realise that Easter is a problem due its flexiable date.

I look forward to peoples responses to this.  
Thanks  
James

---

<div class="post-metadata">

### Author: ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)
#### Post date: [28 May 2023 02:06 UTC](https://discourse.nodered.org/t/sending-emails-on-specific-dates/78744/2 "2023-05-28T02:06:26Z")

</div>

Hi James, welcome to the forum.

It looks like you will be needing some date based arithhmetic - add a calendar month, subtract 9 days.  
node-red-contrib-moment might be useful for this.  
Then keep subtracting a day until your proposed email date is not a saturday, sunday or bank holiday.

You can obtain a list of past and future bank holidays at [https://www.gov.uk/bank-holidays.json](https://www.gov.uk/bank-holidays.json).  
Retrieve it with an HTTP request node set to return a JSON object.  
It has sections "england-and-wales", "scotland" and "northern-ireland".  
You say you want to exclude UK holidays so I guess you will need to compare your proposed email date with all three sections.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [27 July 2023 02:07 UTC](https://discourse.nodered.org/t/sending-emails-on-specific-dates/78744/3 "2023-07-27T02:07:08Z")

</div>

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