簡體   English   中英

運行python電子郵件發送腳本后,Outlook停止工作?

[英]Outlook stops working after running python email sending script?

我編寫了一個腳本,使用python發送電子郵件。 該腳本有效,並且收件人收到了一封電子郵件。 但是,我一直處於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()

您沒有將電子郵件發送到抄送列表。 您將地址添加到郵件的開頭,而不是信封上。

x =s.sendmail(sender, [recipients, CC], msg.as_string())

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM