Skip to content

Instantly share code, notes, and snippets.

Created January 18, 2017 12:29
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 anonymous/3dfa30bf0c9470200e5bcebce723836e to your computer and use it in GitHub Desktop.
Save anonymous/3dfa30bf0c9470200e5bcebce723836e to your computer and use it in GitHub Desktop.
import random
import time
import sys
#INTRO
welcome1 = "Welcome to Python Mail! "
welcome2 = "Here you will be able to send emails, check your inbox, edit contacts, write notes, and edit your calendar. "
#SLOW MOVING TEXT
for l in welcome1:
sys.stdout.write(l)
sys.stdout.flush()
time.sleep(0.02)
print (" ")
for l in welcome2:
sys.stdout.write(l)
sys.stdout.flush()
time.sleep(0.02)
print (" ")
#APPLICATION
contacts = ['test', 'test2']
x=0
while x==0:
try:
ask=str(input("What would you like to do? Send an email, check your contact book, or edit your calendar? "))
if "email" or "mail" or "send" in ask:
print ("Please log in to your email ")
user=str(input("Email "))
pwd=str(input("Password "))
content=str(input("Enter your message "))
sndr=user #this is to prevent email spoofing or fraud
rcpt=str(input("Enter a recipient "))
#EMAIL SEND
import smtplib
mail = smtplib.SMTP('smtp.gmail.com',587) #or port 465
mail.ehlo()
mail.starttls()
mail.login(user,pwd)
mail.sendmail(sndr, rcpt, content)
mail.close()
except smtplib.SMTPAuthenticationError:
print ("Login Failed. Please try again")
#CONTACT BOOK
elif "check" or "contact" or "book" in ask:
print ("working")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment