Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import smtplib
- fromMe = "my yahoo email address here" #from is a key word in python,
- cannot be used as such.
- to = "my yahoo email address here"
- subj = "test smtp email"
- date = "2/1/2010"
- message_text = "Test test."
- msg = "From: %snTo: %snSubject: %snDate: %snn%s" % ( fromMe, to, subj,
- date, message_text )
- username = str("my yahoo email address here")
- password = str("my password here")
- try :
- server = smtplib.SMTP("smtp.mail.yahoo.com",587)
- server.starttls()
- server.login(username,password)
- server.sendmail(fromMy, to,msg)
- server.quit()
- print ("ok the email has sent")
- except :
- print ("can't send the Email")
- Traceback (most recent call last):
- File "c:Users[...]DesktoptempCodeRunnerFile.py", line 1, in <module>
- import smtplib
- File "C:Users[...]AppDataLocalContinuumanaconda3libsmtplib.py", line 47, in <module>
- import email.utils
- File "C:Users[...]AppDataLocalContinuumanaconda3libemailutils.py", line 28, in <module>
- import random
- File "c:Users[...]Desktoprandom.py", line 8
- !python --version
- ^
- SyntaxError: invalid syntax
Add Comment
Please, Sign In to add comment