No attribute 'SMTP', error when trying to send email in Python
问题 I am trying to send an email in Python: import smtplib fromaddr = '......................' toaddrs = '......................' msg = 'Spam email Test' username = '.......' password = '.......' server = smtplib.SMTP('smtp.gmail.com', 587) server.ehlo() server.starttls() server.login(username, password) server.sendmail(fromaddr, toaddrs, msg) server.quit() I understand that this is probably not the correct message format. Anyways, I get an error: C:\.....>python email.py Traceback (most recent