使用smtplib收到的邮件中不包含主题

时间:2019-04-19 11:08:24

标签: python email smtplib

我正在Python中使用smtplib发送邮件。我在下面做了相同的编码。正确的正文和所有但没有主题的邮件成功接收邮件。它显示为“无主题”。

import smtplib


sender = 'singh@xyz.com'
receivers = ['singh2@xyz.com']

message = """From:  Center <singh@xyz.com>
To: To Singh <singh@xyz.com>
Subject: 'Message Status'

THis is e-mail Body.
"""


try:
    smtpObj = smtplib.SMTP('mail22.xyz.rdc', 25)
    smtpObj.sendmail(sender, receivers, message)
    smtpObj.quit()
    print("Successfully sent email")
except SMTPException:
    print("Error: unable to send email")

我试图将主题更改为

Subject: Message Status
Subject: <Message Status>

但是没有用。期望邮件的主题行应为“邮件状态”

0 个答案:

没有答案