Exchangelib:将电子邮件作为通讯组列表发送

发布于 2025-01-09 06:50:32 字数 1337 浏览 1 评论 0原文

我正在使用 Exchangelib python EWS 库发送电子邮件。从我的邮箱发送按预期工作,但如何从已应用“发送为”权限的通讯组列表发送电子邮件(已在 Outlook 中测试更改发件人地址)?

以下代码段将发送电子邮件,但“[电子邮件受保护]”帐户显示为发件人。如果我将“access_type=DELEGATE”更改为“access_type=IMPERSONATION”,我会收到错误“ErrorNonExistentMailbox:SMTP 地址没有与之关联的邮箱。”。

credentials = Credentials("[email protected]", password)
config = Configuration(server=server, credentials=credentials)
account = Account(primary_smtp_address="[email protected]", config=config, autodiscover=False, access_type=DELEGATE)

message = Message(account=account,subject="subject",folder=None)
message.sender = "[email protected]"
message.to_recipients = "[email protected]"
message.body = "test"
message.send(save_copy=False, copy_to_folder=False)

非常感谢任何帮助或指导

I'm using the exchangelib python EWS library to send emails. Sending from my mailbox works as expected but how can I send an email from a distribution list I have "Send As" permissions already applied (Have tested in Outlook changing the from address)?

The below code snippet will send the email but "[email protected]" account shows as the sender. If I change "access_type=DELEGATE" to "access_type=IMPERSONATION", I receive an error "ErrorNonExistentMailbox: The SMTP address has no mailbox associated with it.".

credentials = Credentials("[email protected]", password)
config = Configuration(server=server, credentials=credentials)
account = Account(primary_smtp_address="[email protected]", config=config, autodiscover=False, access_type=DELEGATE)

message = Message(account=account,subject="subject",folder=None)
message.sender = "[email protected]"
message.to_recipients = "[email protected]"
message.body = "test"
message.send(save_copy=False, copy_to_folder=False)

Any help or guidance is very much appreciated

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

溺孤伤于心 2025-01-16 06:50:32

通讯组列表在 Exchange 中通常没有自己的邮箱,因此您不能使用其电子邮件地址作为帐户的 primary_smtp_address

消息同时具有 senderauthor 字段。您可以尝试在author字段中设置通讯组列表电子邮件。然后电子邮件可能会显示为来自该电子邮件地址。

A distribution list usually doesn't have its own mailbox in Exchange, so you can't use its email address as primary_smtp_address for the account.

Messages have both a sender and an author field. You could try to set the distribution list email in the author field. Then emails may show up as coming from that email address.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文