Guest User

Untitled

a guest
Jan 15th, 2019
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. import smtplib
  2. fromMe = "my yahoo email address here" #from is a key word in python,
  3. cannot be used as such.
  4. to = "my yahoo email address here"
  5. subj = "test smtp email"
  6. date = "2/1/2010"
  7. message_text = "Test test."
  8.  
  9. msg = "From: %snTo: %snSubject: %snDate: %snn%s" % ( fromMe, to, subj,
  10. date, message_text )
  11.  
  12. username = str("my yahoo email address here")
  13. password = str("my password here")
  14.  
  15. try :
  16. server = smtplib.SMTP("smtp.mail.yahoo.com",587)
  17. server.starttls()
  18. server.login(username,password)
  19. server.sendmail(fromMy, to,msg)
  20. server.quit()
  21. print ("ok the email has sent")
  22. except :
  23. print ("can't send the Email")
  24.  
  25. Traceback (most recent call last):
  26. File "c:Users[...]DesktoptempCodeRunnerFile.py", line 1, in <module>
  27. import smtplib
  28. File "C:Users[...]AppDataLocalContinuumanaconda3libsmtplib.py", line 47, in <module>
  29. import email.utils
  30. File "C:Users[...]AppDataLocalContinuumanaconda3libemailutils.py", line 28, in <module>
  31. import random
  32. File "c:Users[...]Desktoprandom.py", line 8
  33. !python --version
  34. ^
  35. SyntaxError: invalid syntax
Add Comment
Please, Sign In to add comment