Skip to content
Snippets Groups Projects
Commit c201dbeb authored by Daniel.Kalioudjoglou's avatar Daniel.Kalioudjoglou
Browse files

automatisation envoi mail

parent cefd8f7e
No related branches found
No related tags found
No related merge requests found
...@@ -29,11 +29,11 @@ to_svr_dataviz_ftp("siclop_detail/OF_hors_champ.RData") ...@@ -29,11 +29,11 @@ to_svr_dataviz_ftp("siclop_detail/OF_hors_champ.RData")
### etape de déploiement vers shinyApps.io----------- ### etape de déploiement vers shinyApps.io-----------
# Parametrage du compte rsconnect ssm-ecologie sur ce PC à partir du .Renviron de l'utilisateur du poste # Parametrage du compte rsconnect ssm-ecologie sur ce PC à partir du .Renviron de l'utilisateur du poste
# rsconnect::setAccountInfo(name = Sys.getenv("shinyapps_account"), token = Sys.getenv("shinyapps_token"), rsconnect::setAccountInfo(name = Sys.getenv("shinyapps_account"), token = Sys.getenv("shinyapps_token"),
# secret = Sys.getenv("shinyapps_secret")) secret = Sys.getenv("shinyapps_secret"))
# # Déploiement web tous les 1er du mois, à ne pas faire tourner avec le bureau à distance, # Déploiement web tous les 1er du mois, à ne pas faire tourner avec le bureau à distance,
# if(substr(Sys.Date(), start = 9, stop = 10) == "01") { if(substr(Sys.Date(), start = 9, stop = 10) == "01") {
# rsconnect::deployApp(appDir = "app/", appName = "siclop", account = Sys.getenv("shinyapps_account"), logLevel = "verbose", rsconnect::deployApp(appDir = "app/", appName = "siclop", account = Sys.getenv("shinyapps_account"), logLevel = "verbose",
# server = "shinyapps.io", lint = FALSE) server = "shinyapps.io", lint = FALSE)
# } }
...@@ -53,22 +53,23 @@ write.xlsx(supervision_new,"supervision/supervision.xlsx") ...@@ -53,22 +53,23 @@ write.xlsx(supervision_new,"supervision/supervision.xlsx")
# ----------- # -----------
# # envoi mail si 0 annonce # # envoi mail si 0 annonce
# library(gmailr)
# gm_auth_configure(path = "X:/SCTE/CSD/APPLICATIONS_SIG_BUREAUTIQUES/RESSOURCES_R/client_secret_api_gmail_csd.json")
# gm_auth()
# test_email <-
# gm_mime() %>%
# gm_to("daniel.kalioudjoglou@developpement-durable.gouv.fr") %>%
# gm_from("csd.scte.dreal.pdl@gmail.com") %>%
# gm_subject("this is just a gmailr test") %>%
# gm_text_body("Can you hear me now?")
#
# # Verify it looks correct
# gm_create_draft(test_email)
#
# # If all is good with your draft, then you can send it
# gm_send_message(test_email)
if(nb_new > 1 | nb_lines_new == 0){
library(gmailr)
gm_auth_configure(path = "X:/SCTE/CSD/APPLICATIONS_SIG_BUREAUTIQUES/RESSOURCES_R/client_secret_api_gmail_csd.json")
gm_auth()
test_email <-
gm_mime() %>%
gm_to(c("daniel.kalioudjoglou@developpement-durable.gouv.fr","Juliette.Engelaere@developpement-durable.gouv.fr","christelle.belkacem@developpement-durable.gouv.fr")) %>%
gm_from("csd.scte.dreal.pdl@gmail.com") %>%
gm_subject("Erreur chargement Siclop") %>%
gm_text_body("Une erreur est sans doute survenue dans le chargement des annonces. Vérifier le nombre d'annonces chargées dans le fichier joint") %>%
gm_attach_file("supervision/supervision.xlsx")
# Verify it looks correct
gm_create_draft(test_email)
# If all is good with your draft, then you can send it
gm_send_message(test_email)
}
# ----------- # -----------
......
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment