如何使用 RDCOMClient 将我的 Outlook 电子邮件签名添加到 COM 对象 [英] How to add my Outlook email signature to the COM object using RDCOMClient

查看:29
本文介绍了如何使用 RDCOMClient 将我的 Outlook 电子邮件签名添加到 COM 对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将 RDCOMClient 用于我的一些工作流程,感谢 agstudy 的回答 这里 我可以通过 r 发送电子邮件,但我不知道如何添加我的 Outlook 电子邮件签名.我是 COM 对象的新手,但已经进行了相当多的搜索,但没有找到任何东西.因为我的声誉还没有达到 50,所以我无法在初始线程上发表评论.有人可以告诉我如何添加 Outlook 电子邮件签名吗?

I am working RDCOMClient into some of my work flow and thanks to agstudy's answer Here I am able to send emails throuhg r, but I can't figure out how to add my Outlook email signature. I'm new to COM objects, but have done a fair share of searching and haven't found anything. Because my reputation hasn't hit 50 yet, I wasn't able to comment on the inital thread to ask there. Can someone show me how I can add my Outlook email signature?

library(RDCOMClient)
OutApp <- COMCreate("Outlook.Application") 
outMail = OutApp$CreateItem(0)
outMail[["To"]] = "dest@dest.com"
outMail[["subject"]] = "some subject"
outMail[["body"]] = "some body"
## I want to add my outlook signature here.                     
outMail$Send()

推荐答案

考虑使用 Outlook 的 GetInspector() 属性.假设您有一个自动签名,分配一个变量来捕获默认正文,然后连接到您的后一条消息:

Consider using Outlook's GetInspector() property. Assuming you have an auto-signature, assign a variable to capture the default body and then concatenate to your latter message:

library(RDCOMClient)

olMailItem = 0
OutApp <- COMCreate("Outlook.Application")
outMail <- OutApp$CreateItem(olMailItem)

outMail$GetInspector()
signature = outMail[["HTMLBody"]]

outMail[["Recipients"]]$Add("dest@dest.com")
outMail[["Subject"]] = "some subject"
outMail[["HTMLBody"]] = paste0('<p>some body', signature, '</p>')

outMail$Display()
outMail <- NULL
OutApp <- NULL

这篇关于如何使用 RDCOMClient 将我的 Outlook 电子邮件签名添加到 COM 对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆