Getting notified by e-mails
Even after accomplishing the previous project, it still feels as if something is missing. Why should we continuously look at the data and check whether there is a critical condition or not? We will therefore add the following functionality: every night at 12:00 a.m., the RasPi will send an e-mail stating the minimum and maximum temperatures of the day. We will get the warning e-mail by setting a threshold value of temperature whenever the critical condition arises. Suppose 30 degrees Celsius is the limit, and increasing the temperature beyond that may be the sign of a critical condition at your home.
Here, we are going to use an inbuilt Python library called smtplib
to get the functionalities of sending e-mails from the RasPi. The smtplib
module outlines the Simple Mail Transfer Protocol (SMTP) client, which can be imported to send an e-mail from a client to any Internet machine using the SMTP daemon. The mimetypes
module provides us with the functionality to convert...