Skip to content

Instantly share code, notes, and snippets.

@BMU-Verlag
Created April 21, 2020 08:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BMU-Verlag/9a03c6336e9a6d3d495ed291f4e37a2c to your computer and use it in GitHub Desktop.
Save BMU-Verlag/9a03c6336e9a6d3d495ed291f4e37a2c to your computer and use it in GitHub Desktop.
def send_email(article_details):
server = smtplib.SMTP('smtp.gmail.com', 587)
server.ehlo()
server.starttls()
server.ehlo()
server.login(MAIL_ADDRESS, PASSWORD)
subject=f"{article_details['name']} price below {article_details['target_price']} €"
body=f"The article {article_details['name']} is available for {article_details['price']} €. Check it here: {article_details['url']}"
message = f'Subject: {subject}\n\n{body}'
server.sendmail(MAIL_ADDRESS, MAIL_ADDRESS, message.encode('utf8'))
server.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment