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.

1. So 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.

e.g.

HINT: You can test the email by changing the target price to above the current live price of the product, e.g. $200.


SOLUTION


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)