I coded an R script in order to create mail alert every day at a predetermined time. When I manually execute the code, it works great and I can receive the email in no time. However, when I run the script with task scheduler, it just failed to get the task done.
Below is my code, and my question is did I make a mistake when assigning the task or writing the code?
library(mailR)
message1="hello"
message2="hello"
send.mail(from ="xxxxxx@gmail.com",
to = c("xxxxxx@gmail.com"),
subject = "Summary of stock performance",
#body =paste(message1,"\r\n",message2),
body = paste("<p> Overall </p>",message1,"<p>",message2,"<p>"),
#body = paste(message1,"\r\n",message2,"\r\n"),
#body="hello",
html = TRUE,
inline = TRUE,
smtp = list(host.name = "smtp.gmail.com", port = 465, user.name = "xxxxxx", passwd = "xxxxxxx", ssl = TRUE),
authenticate = TRUE,
send = TRUE)