How to add my Outlook email signature to the COM object using RDCOMClient

前端 未结 1 1104
逝去的感伤
逝去的感伤 2020-12-10 16:08

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 ema

相关标签:
1条回答
  • 2020-12-10 17:02

    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
    
    0 讨论(0)
提交回复
热议问题