library(blastula) blastula::create_smtp_creds_file( file = "mailtrap_file", host = "mailhost.cms.hu-berlin.de", port = 25, use_ssl = TRUE, user = "colombju" ) # #email reminder app # # #1 survey analysis # # #read google doc # # library (googlesheets) # gs_auth() # # PIlist = gs_url ("https://docs.google.com/spreadsheets/d/1jVBj0RBZ4zFwtL1dcy-D9UA_QRvkGhX8s5_sWI8toEk/edit#gid=390395480") # # data= googlesheets::gs_read_csv(PIlist, skip =2) # # remind = data[data$`Data Survey`== "0",] # # text2= "" # for (i in c(1:15)) { # text =paste0(" ",i,remind$`Last name`[i]," ") # text2 = paste0 (text2, text, collapse = "
") # } # # # # # 2 image and orcid library (readr) library(dplyr) people_sfb <- read_delim("/Users/colombj/github_repo/01_sfb1315/WEBSITE_SFB1315_academictheme/automation_websiteelementscreation/SFBpeopel_current.csv", "\t", trim_ws = TRUE, skip = 0, na=c("")) newlist<- read_csv("/Users/colombj/github_repo/01_sfb1315/WEBSITE_SFB1315_academictheme/automation_websiteelementscreation/newlistfromgoogle.csv") peoplelist_respori <- read_delim("~/Documents/Seafile/SFB1315info/allpeople.csv", "\t", escape_double = FALSE, trim_ws = TRUE) peoplelist= right_join( peoplelist_respori, newlist, by=c("email"= "Email")) peoplelist_sub = peoplelist[!is.na(peoplelist$SFBgroup),] peoplelist_sub$project_responsible[is.na(peoplelist_sub$project_responsible)] <- "FALSE" groups = unique(peoplelist_sub$SFBgroup) ## this one is sent only to the responsible person text2 = "" peoplelist_resp <- subset(peoplelist_sub, peoplelist_sub$project_responsible == TRUE) for (group in groups){ #group = "Z" footer = "" peoplelist_group <- peoplelist_resp[peoplelist_resp$SFBgroup == group,] if (nrow(peoplelist_group) == 0){ #peoplelist_group <- peoplelist_sub[peoplelist_sub$SFBgroup == group,] peoplelist_group <- peoplelist_sub %>% filter(grepl (group, Project)) footer= "PS: I would only need to send this email to one person, if you indicate a person of contact for the creation of the project page for your group." } emails = paste0(peoplelist_group$email, collapse = ",") text_mail = paste0(" The website will soon go live, I extended the ", footer) text =paste0(" ", group," ") text2 = paste0 (text2, text, sep = "
") } # ## this one sent to everyone ! # text2 = "" # peoplelist_resp <- peoplelist_sub # for (group in groups){ # #group = "Z" # footer = "Best regards," # peoplelist_group <- peoplelist_resp[peoplelist_resp$SFBgroup == group,] # if (nrow(peoplelist_group) == 0){ # peoplelist_group <- peoplelist_sub[peoplelist_sub$SFBgroup == group,] # footer= "Best regards," # } # # emails = paste0(peoplelist_group$email, collapse = ",") # text_mail = paste0(" # # Please visit https://deploy-preview-3--adoring-tereshkova-f0b719.netlify.app/project/",group," . # # This page will present you and your project, including (after login) the SmartFigures related to your project. This new version of the website will go live on JUNE 1st, contact me if you are not happy with the project page or the personal page design. # # The new version of the smartfigure gallery went live this week. You are now able to create your own group (for example for your lab), and each figure can be shared with different groups. # I will be creating new accounts for PIs (I did it already for phds and postdocs last year) with access to the 'sfb1315 Members' sharing group. You will be able to sign in with this email address, the default password is 'resultgallery' (if you do not have access by tomorrow, drop me an email). # # # Walkthrough to add content for: # - your project smartfigure gallery: https://www.sfb1315-output.de/post/smartfigure-preview/ # - your personal page: https://www.sfb1315-output.de/post/using-orcid/ # # ", footer) # # text =paste0(" ", # group," ") # # text2 = paste0 (text2, text, sep = "
") # # # } # text2 = "" # peoplelist_resp <- subset(peoplelist_sub, peoplelist_sub$project_responsible == TRUE) # for (group in groups){ # #group = "Z" # footer = "" # peoplelist_group <- data.frame() # # # # if (nrow(peoplelist_group) == 0){ # #peoplelist_group <- peoplelist_sub[peoplelist_sub$SFBgroup == group,] # peoplelist_group <- peoplelist_sub %>% filter(grepl (group, Project)) # #footer= "PS: I would only need to send this email to one person, if you indicate a person of contact for the creation of the project page for your group." # } # # emails = paste0(peoplelist_group$email, collapse = ",") # text_mail = paste0(" # # Please accept my apologies for having used an outdated personel list. # I updated the website according to the latest spreadsheet curated by Marylu : https://deploy-preview-3--adoring-tereshkova-f0b719.netlify.app/project/",group," . # # The website lauch was reported to give you time to check it, maybe you want to sent me a figure for the project thumbnail. # # NB you can add content for: # - your project smartfigure gallery: https://www.sfb1315-output.de/post/smartfigure-preview/ # - your personal page (including image): https://www.sfb1315-output.de/post/using-orcid/ # # ", footer) # # text =paste0(" ", # group," ") # # text2 = paste0 (text2, text, sep = "
") # # # } fileConn<-file("remind.html") writeLines(c(text2), fileConn) close(fileConn) browseURL("remind.html") if (FALSE){ text2 = "" peoplelist_resp <- peoplelist_sub %>% filter (role.x != "PI") #for (group in peoplelist_resp$peoplecode){ for (group in peoplelist_resp$peoplecode[-c(1:j)]){ #group = "julien-colomb" footer = "Best regards," peoplelist_group <- peoplelist_resp[peoplelist_resp$peoplecode == group,] emails = paste0(peoplelist_group$email, collapse = ",") thetitle = "thank you for your help, dear SFB member" text_mail = paste0(", I really appreciate the fact you took 10 minutes of your time to take our survey and think about file organisation for your project(s), I wish you a wonderful day. Julien *PS: This message was sent the 27.09.2020: in order to prevent a time paradox, please take the survey if you did not do so yet:* https://umfrage.hu-berlin.de/index.php/622476?newtest=Y ") img_string <- add_image(file = "~/github_repo/05_old_rdm/rdm_promotion/website_build/static/material/CC-BY-NC/futureself.png", width = 300) #img_string <- add_image(file = "~/github_repo/05_old_rdm/rdm_promotion/website_build/static/material/CC-BY-NC/datafile_naming_xkcd.png", width = 300) email <- compose_email( title = "SFB1315, GIN-tonic survey", body = md( paste0("Dear " , peoplelist_group$`First name`, text_mail," ")) ,footer = md(paste0("Dr. Julien Colomb, SFB1315 project Z, (Email created with the *R blastula package*),", img_string )) ) #email print(group) smtp_send( email = email, subject = thetitle, from = "julien.colomb@hu-berlin.de", to = emails, credentials = creds_file("mailtrap_file") ) } } ## this one sent to phds, directly ! NB only works in look with VPN to HU Berlin on!