如何使用pywin32重定向Outlook邮件
旧消息是初始消息,新消息是我要转发的消息。这就是我尝试的,它似乎不起作用。我不能代表使用帐户发送的发送发送,因为这意味着我需要将原始发件人放在邮箱中。
NewMsg = oldmessage.Forward()
NewMsg.ReplyRecipients.Add(oldmessage.SenderEmailAddress)
NewMsg.Recipients.ResolveAll
NewMsg.Save
NewMsg.Body = oldmessage.Body
NewMsg.Subject = "Forwarded to Treat: " + oldmessage.Subject
NewMsg.To = [email protected]
NewMsg.Send()
old message is initial message and new message is the message I want to forward. This is what I have tried, it does not seem to work. I cant use send On behalf of an send Using Account as it means I need to have the original sender in my mailbox.
NewMsg = oldmessage.Forward()
NewMsg.ReplyRecipients.Add(oldmessage.SenderEmailAddress)
NewMsg.Recipients.ResolveAll
NewMsg.Save
NewMsg.Body = oldmessage.Body
NewMsg.Subject = "Forwarded to Treat: " + oldmessage.Subject
NewMsg.To = [email protected]
NewMsg.Send()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
两者之间有区别。
使用帐户功能发送的发送需要在Outlook配置文件中配置另一个帐户,请参见 mailItem.sendusiseAccount 属性返回或设置
account
对象,该对象表示将要发送mailItem
的帐户。代表另一个人发送的发送需要邮箱所有者的权限, mailItem.sentonbehalfofname 属性返回一个字符串,指示邮件邮件的预期发件人的显示名称。There is a difference between the two.
The send using account feature requires another account to be configured in the Outlook profile, see the MailItem.SendUsingAccount property which returns or sets an
Account
object that represents the account under which theMailItem
is to be sent. The send On behalf of another person requires permissions from the mailbox owner, the MailItem.SentOnBehalfOfName property returns a string indicating the display name for the intended sender of the mail message.您无法保留原始发件人 - Outlook不知道您正在尝试重定向,并且Outlook(和Exchange Server)将阻止您欺骗任意发送者。
在旧的交换世界中,可以创建使用
fwd_preserve_sender |的服务器端规则| fwd_do_not_munge_msg
flag和op_forward
的动作,但我认为如今不使用Outlook使用这些标志,但是扩展的Mapi(仅C ++或Delphi)仍然可以用来像创建一个规则一样那。编辑:保留发件人的服务器端规则,并且仍然可以使用赎回(我是它的作者):
You cannot keep the original sender - Outlook has no idea that you are trying to redirect, and Outlook (and Exchange server) will prevent you from spoofing an arbitrary sender.
In the old Exchange world, one could create a server-side rule that used
FWD_PRESERVE_SENDER | FWD_DO_NOT_MUNGE_MSG
flags and the action ofOP_FORWARD
, but I don't think Outlook uses these flags nowadays, but Extended MAPI (C++ or Delphi only) can probably still be used to create a rule like that.EDIT: Server-side rules that preserve the sender and the message can still be created using Redemption (I am its author):