We want to get an email when the price of our product is below a certain value. e.g in the case of the Instant Pot, we'll set the target price as $100.
When the price is below 100 then use the smtp module to send an email to yourself. In the email, include the title of the product, the current price and a link to buy the product.
This is what you're aiming for:

On our static page, the price is set for $99.99 so you can test the email functionality by setting your target price to $100 or higher.
We've already covered environment variables in Day 35 and Day 38. It's good practice to hide sensitive information like passwords, email addresses and API keys. A good way to hide your information is by keeping it separate from the source code in your .py files.
1. Create a .env file.

2. Your .env file should consist of key value pairs where you store your personal information. It should look something like this.
SMTP_ADDRESS="smtp.gmail.com" EMAIL_ADDRESS="angela@email.com" EMAIL_PASSWORD="Use_an_App_Password_from_your_email_provider"
3. In your main.py file use the os and dotenv modules to remove your personal information from the .py file.
The dotenv documentation shows how to go about it: https://pypi.org/project/python-dotenv/

NOTE: If you have issues and keep getting this error:

1. Make sure you've got the correct smtp address for your email provider:
Gmail: smtp.gmail.com
Hotmail: smtp.live.com
Outlook: outlook.office365.com
Yahoo: smtp.mail.yahoo.com
If you use another email provider, just Google for your email provider e.g. "Gmail SMTP address"
Below are steps specific to users sending email from Gmail and Yahoo addresses as outlined in the Birthday Wisher on Day 32.

2. Turn on 2-Step Verification for your email under the Security settings for your account. For example, Manage Your Google Account -> Security.

3. Add an App Password under your email settings. Select "Other" from the drop-down settings and choose a password. Use this app password in your Python code.

4. Add a port number by changing your code to this:
smtplib.SMTP("smtp.gmail.com", port=587)