HowTo: NodeRed – Send E-Mail on Events

(I think) E-mails are one of the oldest ways to communicate on the Internet. By contrast, they do not play a major role in the smart home sector. For fast and direct data exchange, it is often better to use push services – such as Pushbullet – or direct MQTT.

In some cases it can be handy to send an e-mail from NodeRed. For example, in this way you could send a monthly status report as a monthly summary to your own e-mail inbox.
Or you send yourself daily the current weather report. The possibilities are almost unlimited. If you have any other useful uses, feel free to leave a comment with your idea. 🙂

The following article explains how you can email the current weather report for an event.

Hints for our lovely english readers: Basically, many of the articles on are translations from the original german articles. Therefore, it may happen here and there that some illustrations are not available in english and that some translations are weird/strange/full of mistakes or generally totaly wrong. So if you find some obvious (or also not obvious) mistakes don't hesitate to leave us a hint about that in the comment section. 
Also please don't get confused, that instead of a "dot" often a "comma" is used as decimal separator. 🙂

Safety instructions

I know the following hints are always a bit annoying and seem unnecessary. But unfortunately, many people who knew it "better" from carelessness lost their eyes, fingers or other things or hurt themselves. In comparison, a loss of data is almost not worth mentioning, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Even the coolest project is worth no injury or other annoyance.


Helpful Articles:
Of course NodeRed should already be installed so that you can take over this configuration.
How to prepare a RaspberryPi and then install NodeRed on it, is described in the following articles.
RaspberryPi – Setting up for Nerdiys!
RaspberryPi – The first configuration
RaspberryPi – Controlling the RaspberryPi via SSH
NodeRed – Installing NodeRed on the RaspberryPi
NodeRed – Install New Nodes

NodeRed – Get current weather data from OpenWeatherMap

Required tools:

Required material:

In the following list you will find all the parts you need to implement this article.

Log in to the NodeRed configuration interface

Before you can edit your NodeRed configuration you must - if activated - first log in to the NodeRed configuration interface.

View of the login screen. Here you have to enter the login details that you entered during the configuration of the login. Information about this can be found in the article NodeRed - User Login Setup.

Prepare openWeatherMap node

In order for you to be able to collect the data to be sent by e-mail, you must have the openWeatherMap node running in your NodeRed configuration. The necessary steps are described in the article NodeRed – Get current weather data from OpenWeatherMap.


Node-code Example: The current weather data received by e-mail

For this example, you do not need any other than the default installed nodes. To apply the configuration, you only have to import the node code below into your configuration. How to do this is explained in the article NodeRed – Install New Nodes.

After importing the Node code you have to add a few configurations to each node.

View of the node configuration in the editor.


[{"id":"3aab8493.0bc2fc","type":"e-mail","z":"550c7bf5.5c03e4","server":"","port":"465","secure":true,"name":"","dname":"sendEmail","x":1050,"y":380,"wires":[]},{"id":"51ae2d16.38b7a4","type":"change","z":"550c7bf5.5c03e4","name":"tempConvert","rules":[{"t":"set","p":"data.main.temp","pt":"msg","to":"data.main.temp-273.15","tot":"jsonata"},{"t":"set","p":"data.main.temp_min","pt":"msg","to":"data.main.temp_min-273.15","tot":"jsonata"},{"t":"set","p":"data.main.temp_max","pt":"msg","to":"data.main.temp_max-273.15","tot":"jsonata"},{"t":"set","p":"title","pt":"msg","to":"Aktueller Wetterbericht","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":380,"wires":[["41a940d8.99eb7"]]},{"id":"ca0b22a9.c0272","type":"json","z":"550c7bf5.5c03e4","name":"","property":"payload","action":"","pretty":false,"x":510,"y":380,"wires":[["51ae2d16.38b7a4"]]},{"id":"a7dc889e.b097a8","type":"inject","z":"550c7bf5.5c03e4","name":"request data","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":440,"wires":[["9e4b2651.4217b8"]]},{"id":"9e4b2651.4217b8","type":"openweathermap","z":"550c7bf5.5c03e4","name":"","wtype":"current","lon":"","lat":"","city":"Bochum","country":"Germany","language":"de","x":350,"y":440,"wires":[["ca0b22a9.c0272"]]},{"id":"314b9fd1.5d28e","type":"openweathermap in","z":"550c7bf5.5c03e4","name":"","wtype":"current","lon":"","lat":"","city":"Bochum","country":"Germany","language":"de","x":160,"y":380,"wires":[["ca0b22a9.c0272"]]},{"id":"41a940d8.99eb7","type":"template","z":"550c7bf5.5c03e4","name":"mailTemplate","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Hallo lieber E-Mail-Empfänger, \nhier kommen die aktuellen Wetterdaten vom {{time}} für {{}}. \nTemperatur: {{data.main.temp}}°C,\nMinimale Temperatur {{data.main.temp_min}}°C,\nMaximale Temperatur {{data.main.temp_max}}°C,\nLuftfeuchtigkeit {{data.main.humidity}}%,\nLuftdruck: {{data.main.pressure}}mmHg,\nWindstärke: {{data.wind.speed}},\nWindrichtung: {{data.wind.deg}}°\n\nLiebe Grüße\nDein NodeRed\n\n","output":"str","x":850,"y":380,"wires":[["d81ba695.75a538","3aab8493.0bc2fc"]]},{"id":"d81ba695.75a538","type":"debug","z":"550c7bf5.5c03e4","name":"rawData","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1040,"y":320,"wires":[]}]
For this example to work, you need to edit the email node. There you have to enter the server data of your e-mail server. To do this, enter the URL of your SMTP server under “Server”, the corresponding user name under “UserId” and the appropriate password under “Password”. Last but not least, you have to enter the recipient email to which the email should be sent in the first line under “To”.
In the template node you can edit the e-mail sent text and customize it to your needs.
You can also edit the subject of the e-mail in the change node. In the last line, the variable “Msg.title” is set, whose content is then used as the subject in the e-mail node.

I hope everything worked as described. If not or you have any other questions or suggestions, please let me know in the comments. Also, ideas for new projects are always welcome. 🙂


P.S. Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you appreciate it that I share these information with you, I would be happy about a small donation to the coffee box. 🙂

Buy Me a Coffee at

Leave a Reply

Your email address will not be published. Required fields are marked *