import smtplib import urllib.request def sendmail(reciever): content = input("What do you want to send in your email? ") message = """From: From Jarek's web To: To you Subject: The web got some updates """ message = message + content mail = smtplib.SMTP('smtp.gmail.com', 587) mail.ehlo() mail.starttls() mail.login('your mail', 'your password') mail.sendmail('your mail', reciever, message) mail.close() def getfromweb(): response = urllib.request.urlopen('url of the file which contains the email adresses') #should be a text file with each email on a new line maillist = str(response.read()) maillist = maillist.split("\\n") sendmail(maillist) getfromweb() while True: a = str(input("Do you want to send another email?[y/n] ")) if a == ('y' or 'yes' or "1"): getfromweb() elif a == ('n' or 'no' or "0"): print("© Jarek 2018") raise SystemExit