Sending email from python and the error keeps popping up
I am trying to send email with Python and am getting errors. Here is my code:
import smtplib
server = smtplib.SMTP('smtp.gmail.com', 465)
server.login("someone@gmail.com", "pass")
msg = "Hello!"
server.sendmail("someone@gmail.com", "someone@gmail.com", msg)
print("Sent")
This is the error I keep getting
Traceback (most recent call last):
File "C:/Users/me/Desktop/Python/email65.py", line 1, in <module>
import smtplib
File "C:\Users\me\AppData\Local\Programs\Python\Python36-32\lib\smtplib.py", line 47, in <module>
import email.utils
File "C:/Users/me/Desktop/Python\email.py", line 1
import smtplib from email.mime.multipart
^
SyntaxError: invalid syntax'
What am I doing wrong?
+3
source to share
3 answers