I need to send mail to all email ids in a column of the data frame. The column values are dynamically changing. I have used FOR loop for this but end up receiving the below warning and it sends mail only to 1st mail id in the column.
Datacheck=(Data=c("mess@xyz.com","ghyh@xyz.com")
for (mail in Datacheck$Data)
{
outApp <- COMCreate("Outlook.Application")
outMail = outApp$CreateItem(0)
outMail[["To"]] = mail
outMail[["subject"]] = "Subject"
#outMail[["body"]] = paste(" Hi" "\n \n checkk.")
outMail$Send()
Sys.sleep(0.5)
if (mail == Datacheck$Data[-1]) cat("Done!")
}
Warning
1: In if (mail == Datacheck$Data[-1]) cat("Done!") :
the condition has length > 1 and only the first element will be used
2: In if (mail == Datacheck$Data[-1]) cat("Done!") :
the condition has length > 1 and only the first element will be used