Hey guys!
I wrote a R script to send emails using {gmailr} package. Works fine manually.
I tried to automate using R taskscheduler option with the following code and returns an error.
library(gmailr)
library(tidyverse)
library(dplyr)
library(taskscheduleR)
taskscheduler_create(taskname = "auto_email",
rscript = scheduled_script_path,
schedule = "MINUTE",
starttime = format(Sys.time(), "%H:%M:%S"),
startdate = format(Sys.time(), "%m/%d/%Y"))
test_email <-gm_mime() %>%
gm_to("receipent@gmail.com") %>%
gm_from("sender@gmail.com") %>%
gm_subject("this is just a gmailr test") %>%
gm_text_body("Can you hear me now3?")
# Send Email
gm_send_message(test_email)
Aforementioned code halts the execution with the following message in the log file.
"Error: Must create an app and register it with gm_auth_configure()
Execution halted"
Any suggestions?
Thank you in advance.
Karthik