0

Below is the code created to send an email via 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()

The output is :

Hello Below are the contents of the email

The output should be:

Hello

Below are the contents of the email

Thank you for the help.

1 Answers1

1

if you have two elements

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

and you need to print in two lines, you can use writeLines with paste:

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