Remember those ancient days of Chapter 2, Basic Programming Recipes, when you were just learning how to send an e-mail with Node.js? No? You skipped that recipe? Well, you may want to do that one before you dive into this one. In this recipe, we'll perform something similar and have the script run at boot up. Instead of having Node.js perform the job, it'll be Python and systemd.
The scenario is that you need to control your BBB remotely via SSH or VNC, but the board is offsite or running headless. As you have learned previously, in order to control the BBB remotely, we have to know the board's IP address. If you're in front of the board, it's easy enough to check the IP at the bottom of your screen via the GUI popup. However, our board is 100 miles away and isn't attached to a display. Systemd (with a healthy dash of Python) comes to the rescue!
Let's take a look at how we can have systemd send us this magical IP-addressed e-mail.