简体   繁体   English

如何阻止Outlook / Office365更改标题?

[英]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.

相关问题 Office365身份验证:从访问令牌获取用户电子邮件 - Office365 Authentication: getting user email from access token Python:如何将电子邮件文本正文传递给Office365电子邮件 - Python: How to pass email text body to Office365 Email 如何使用 office365 在 Django 中发送 Email - How to send Email in Django using office365 无法发送电子邮件 nodemailer / office365 - Unable to send email nodemailer / office365 未找到模块错误:未找到 office365 - Module Not found error: office365 not found Shareplum Office365 连接自发断了 - Shareplum Office365 connection spontaneously broke 使用 Python 访问 Office365 Sharepoint REST 端点(Python 的 Office365 Sharepoint REST 客户端) - Accessing Office365 Sharepoint REST EndPoints using Python (Office365 Sharepoint REST client for Python) 如何使用用户名为别名的OAuth2.0对Office365用户进行身份验证? - How to authenticate Office365 users using OAuth2.0 where username is alias? 如何使用工作或学校帐户在 Python 中阅读 SharePoint Online (Office365) Excel 文件? - How to read SharePoint Online (Office365) Excel files in Python with Work or School Account? 如何将文件夹及其内容复制到 SharePoint 中的新位置 python office365 模块在线 - How to copy folder and its content into new location in SharePoint Online with python office365 module
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM