[英]How do I stop Outlook/Office365 from changing a header?
I am using the Python library smtplib
to send Email messages with Office365 as the SMTP server. 我正在使用Python库
smtplib
以Office365作为SMTP服务器发送电子邮件。 Everything was fine until a few days ago when my From:
header seemed to not be processed. 一切都很好,直到几天前我的
From:
标头似乎没有被处理。 The Python code I am using: 我正在使用的Python代码:
import smtplib
from email.mime.text import MIMEText
def login():
server = smtplib.SMTP(mail.mail_server, mail.mail_port)
server.starttls()
server.login(mail.mail_username, mail.mail_password)
return server
def send(subject, body):
msg = MIMEText(body)
msg["From"] = mail.mail_from
msg["To"] = ", ".join(mail.mail_to)
msg["Subject"] = subject
server = login()
server.sendmail(mail.mail_username, mail.mail_to, msg.as_string())
server.quit()
send("test", "test")
What is strange is that if I log onto Outlook or OWA, I can see my header if I view the sent message details. 奇怪的是,如果我登录到Outlook或OWA,如果查看发送的邮件详细信息,就可以看到标题。 I sent a test header of
From: xxxx <info@...>
我发送了一个
From: xxxx <info@...>
的测试头From: xxxx <info@...>
However on the recipients inbox message, the header is simply the Office365 User's name and the info address as shown above ( From: Name <info@...>
). 但是,在收件人收件箱消息上,标头只是上面显示的Office365用户的名称和信息地址(
From: Name <info@...>
)。 The xxxx custom header is gone. xxxx自定义标头不见了。
What can be causing my header to be dropped? 是什么导致我的标题被丢弃?
尽管这可能不是理想的解决方案,但我最终使用自己想要的名称设置了一个新的电子邮件帐户并使用了该帐户,而不是尝试强制使用From:
标头。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.