Skip to content

Instantly share code, notes, and snippets.

@Nick3523
Last active February 3, 2020 07:45
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 Nick3523/b50cd2aef23fbad95d1beec69ed1ad71 to your computer and use it in GitHub Desktop.
Save Nick3523/b50cd2aef23fbad95d1beec69ed1ad71 to your computer and use it in GitHub Desktop.
import yagmail
import random
from datetime import datetime
yag = yagmail.SMTP("email_envoyeur@gmail.com","mot_de_passe")
quote = ""
date = datetime.today().strftime('%d-%m-%Y')
with open("citations.txt", encoding = "ISO-8859-1") as file:
s = file.readlines()
quote = random.choice(s)
yag.send('email_destinataire@gmail.com', 'Citation du jour '+date, quote)
##Pour pouvoir lancer le script de manière quotidienne, j'utilise mon raspberry pi avec crontab##
##0 7 * * * /usr/bin/python3 /home/pi/QuoteSender/quoteSender.py <=> chaque jour à 7h pile, le programme est exécuté automatiquement ##
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment