import smtplib
# Email configuration
EMAIL_ADDRESS = "your_email@example.com"
EMAIL_PASSWORD = "your_password"
def send_email_alert(product, price):
subject = "Price Drop Alert!"
body = f"The price of '{product}' has dropped to ${price}. Check it out here: {URL}"
message = f"Subject: {subject}\n\n{body}"
# Connect to the email server and send the email
with smtplib.SMTP("smtp.gmail.com", 587) as server:
server.starttls()
server.login(EMAIL_ADDRESS, EMAIL_PASSWORD)
server.sendmail(EMAIL_ADDRESS, EMAIL_ADDRESS, message)
print("Email alert sent!")
Use the schedule
library to run the script periodically (e.g., every hour).