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

查看:98
本文介绍了如何使用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的

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天全站免登陆