相关疑难解决方法(0)

使用python 3.4回复电子邮件

我正在尝试使用Python 3.4回复电子邮件.电子邮件的收件人将使用Outlook(不幸的是),Outlook识别回复并正确显示该线程非常重要.

我目前的代码是:

def send_mail_multi(headers, text, msgHtml="", orig=None):
    """
    """

    msg = MIMEMultipart('mixed')
    # Create message container - the correct MIME type is multipart/alternative.
    body = MIMEMultipart('alternative')

    for k,v in headers.items():
        if isinstance(v, list):
            v = ', '.join(v)
        msg.add_header(k, v)

    # Attach parts into message container.
    # According to RFC 2046, the last part of a multipart message, in this case
    # the HTML message, is best and preferred.
    body.attach(MIMEText(text, 'plain'))
    if msgHtml != "": body.attach(MIMEText(msgHtml, 'html'))
    msg.attach(body)

    if orig …
Run Code Online (Sandbox Code Playgroud)

python email outlook smtp reply

6
推荐指数
1
解决办法
4862
查看次数

标签 统计

email ×1

outlook ×1

python ×1

reply ×1

smtp ×1