在R中创建Outlook电子邮件时,如何在电子邮件正文中添加新行?

时间:2018-07-17 14:16:58

标签: r

下面是创建用于通过r发送电子邮件的代码。

 OutApp <- COMCreate("Outlook.Application")
 outMail = OutApp$CreateItem(0)
 outMail[["To"]] = "personperson@gmail.com"
 outMail[["subject"]] = "SUBJECT"
 outMail[["body"]] = paste("Hello","Below are the contents of the email")
 outMail$Send()

输出为:

Hello Below are the contents of the email

输出应为:

Hello

Below are the contents of the email

感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

如果您有两个元素

a <- "hello"
b <- "World"

,您需要两行打印,可以将writeLinespaste一起使用:

> writeLines(paste(a, b, sep = "\n"))
hello
World