Sending Scheduled emails in R {gmailr} {taskscheduleR}

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

It looks like you have an authentication error. Before you complete the send email functionally, it may be best to start on the gmailr tutorial . Some Google APIs require a developer account, which in turn, will provide you access to your credentials file.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.