电子邮件是从xx@xxx.com到yy@yyy.com成功地 但它还没有发送到电子邮件中group@xxx.com(通讯组名单)还没有。 我担心python中的smtplib不支持在通讯组列表中提取电子邮件
如果支持==>;如何修复它? 否则不支持==>;您还希望申请什么样的套餐
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
host = 'xxx.xxx.xxx.xxx'
# email
sender = 'xx@xxx.com'
receivers = ['yy@yyy.com']
# distribution list (contact group)
ccs = ['group@xxx.com']
message = MIMEMultipart("alternative")
message["Subject"] = "Test Send Email"
message["From"] = sender
message["To"] = ','.join(receivers)
message["Cc"] = ','.join(ccs)
# Create the plain-text and HTML version of your message
text = """\
Dear All,
Test Send Email
"""
# Turn these into plain/html MIMEText objects
part_plain = MIMEText(text, "plain")
message.attach(part_plain)
try:
with smtplib.SMTP(host) as mail_server:
mail_server.sendmail(sender, receivers, message.as_string())
print("Successfully sent email")
except smtplib.SMTPException as e:
print('SMTP error occurred: ' + str(e))
多谢各位 庞通
目前没有回答
相关问题 更多 >
编程相关推荐