[英]Outlook stops working after running python email sending script?
I wrote a script to send an email using python. 我编写了一个脚本,使用python发送电子邮件。 The script worked and the recipient received an email.
该脚本有效,并且收件人收到了一封电子邮件。 However, I kept myself in CC and I didn't get an email and moreover, my outlook stopped working after that .
但是,我一直处于CC状态,没有收到电子邮件,而且, 此后我的视线停止工作 。
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
def success_email():
sender = 'abhishek_talwar@xyz.com'
recipients = 'GANA_PANGO@xyz.com'
CC = 'abhishek_talwar@xyz.com'
subject = "Load Balance Request Completed"
msg = MIMEMultipart('alternative')
msg['Subject'] = subject
msg['From'] = sender
msg['To'] = recipients
msg['CC'] = CC
# Create the body of the message (a plain-text and an HTML version).
text = 'Hi this is a test mail'
# Record the MIME types of both parts - text/plain and text/html.
part1 = MIMEText(text.encode('utf-8'), 'html')
# Attach parts into message container.
msg.attach(part1)
s = smtplib.SMTP('mail1.xyz.com')
x =s.sendmail(sender, recipients, msg.as_string())
print x
action = 'Success email sent for'
print action
success_email()
You're not sending the email to the CC list. 您没有将电子邮件发送到抄送列表。 You're adding the address in the head of the message, but not on the envelop.
您将地址添加到邮件的开头,而不是信封上。
x =s.sendmail(sender, [recipients, CC], msg.as_string())
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.