Complete the code to import the module needed to send emails.
import [1]
The smtplib module is used to send emails in Python.
Complete the code to check if the sensor value exceeds the threshold.
if sensor_value [1] threshold:
We want to send an alert when the sensor value is greater than the threshold.
Fix the error in the code to create an SMTP connection.
server = smtplib.SMTP([1], 587)
The SMTP server address must be a string, so it needs quotes.
Fill both blanks to log in to the SMTP server with email and password.
server.login([1], [2])
You must provide your email and password as strings to log in.
Fill all three blanks to send an email alert with subject and body.
message = f"Subject: [1]\n\n[2]" server.sendmail([3], 'recipient@example.com', message)
The subject and body are strings, and the sender email is needed to send the mail.
