小编Dat*_* Ha的帖子

得到错误`没有名为mime.text`的模块[Python]

此代码"假设"发送电子邮件.

import smtplib
#SERVER = "localhost"

FROM = 'myEmail@email.com'

TO = ["toEmail@email.com"] # must be a list

SUBJECT = "Hello!"

TEXT = "This message was sent with Python's smtplib."

# Prepare actual message

message = """\
From: %s
To: %s
Subject: %s

%s
""" % (FROM, ", ".join(TO), SUBJECT, TEXT)

# Send the mail

server = smtplib.SMTP('myserver')
server.sendmail(FROM, TO, message)
server.quit()
Run Code Online (Sandbox Code Playgroud)

我收到此错误消息.

Traceback (most recent call last):
  File "C:\Users\myCpu\Documents\myFiles\python\test wy.py", line 1, in <module>
    import smtplib
  File "C:\Python27\lib\smtplib.py", line 46, …
Run Code Online (Sandbox Code Playgroud)

python email sendmail python-2.7

2
推荐指数
2
解决办法
1万
查看次数

标签 统计

email ×1

python ×1

python-2.7 ×1

sendmail ×1