![](/img/trans.png)
[英]How to send email with Do Not Forward flag using exchangelib
[英]Forward email using exchangelib
我需要构建一个应用程序,该应用程序可以在从交换服务器读取正文(和附件)之后简单地转发电子邮件。 该应用程序内置于云中,并使用python编码,因此我们认为我们将使用exchangelib。
由于云架构,我的目标是转发电子邮件以最大程度地减少出口流量。
从exchangelib 源代码 (从778行开始)中,我找到以下代码:
def create_forward(self, subject, body, to_recipients, cc_recipients=None, bcc_recipients=None):
if not self.account:
raise ValueError('%s must have an account' % self.__class__.__name__)
if not self.id:
raise ValueError('%s must have an ID' % self.__class__.__name__)
return ForwardItem(
account=self.account,
reference_item_id=ReferenceItemId(id=self.id, changekey=self.changekey),
subject=subject,
new_body=body,
to_recipients=to_recipients,
cc_recipients=cc_recipients,
bcc_recipients=bcc_recipients,
)
def forward(self, subject, body, to_recipients, cc_recipients=None, bcc_recipients=None):
self.create_forward(
subject,
body,
to_recipients,
cc_recipients,
bcc_recipients,
).send()
我希望当我使用电子邮件消息(以前下载的)作为自己进行转发时,转发的消息将从服务器而不是从调用方获取有效负载。
希望我的问题清楚...
提前致谢
EWS ForwardItem服务不允许引用服务器端项目内容。 您只能通过HTTP请求发送转发的内容。
附件具有自己的ID,因此您可以将原始附件附加到转发项目。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.