0
Ich habe das Skript aus dem ersten Beispiel hier: https://docs.python.org/2/library/email-examples.html#email-examplessmtplib funktioniert nicht
ich sicher, dass es keinen ähnlichen Dateinamen email.py.
import smtplib
# Import the email modules we'll need
from email.mime.text import MIMEText
fp = open(textfile, 'rb')
# Create a text/plain message
msg = MIMEText(fp.read())
fp.close()
# me == the sender's email address
# you == the recipient's email address
msg['Subject'] = 'The contents of %s' % textfile
msg['From'] = [email protected]
msg['To'] = [email protected]
# Send the message via our own SMTP server, but don't include the
# envelope header.
s = smtplib.SMTP('localhost')
s.sendmail(me, [you], msg.as_string())
s.quit()
Der Fehler ist
C:\Users\donald\AppData\Local\Programs\Python\Python35-32\python.exe C:/Users/donald/PycharmProjects/untitled3/testingemail/ff.py
Traceback (most recent call last):
File "C:/Users/donald/PycharmProjects/untitled3/testingemail/ff.py", line 1, in <module>
import smtplib
File "C:\Users\donald\AppData\Local\Programs\Python\Python35-32\lib\smtplib.py", line 47, in <module>
import email.utils
File "C:\Users\donald\AppData\Local\Programs\Python\Python35-32\lib\email\utils.py", line 28, in <module>
import random
File "C:\Users\donald\PycharmProjects\untitled3\random.py", line 1
From random import randint
^
SyntaxError: invalid syntax
Process finished with exit code 1