inst/plumber/07-mailgun/plumber.R

emails <- data.frame(from=character(0), time=character(0), subject=character(0), stringsAsFactors = FALSE)

#* @post /mail
function(from, subject){
  emails <<- rbind(emails, data.frame(from=from, time=date(), subject=htmltools::htmlEscape(subject), stringsAsFactors=FALSE))
  TRUE
}

#* @get /tail
function(){
  tail(emails[,-1], n=5)
}

Try the plumber package in your browser

Any scripts or data that you put into this service are public.

plumber documentation built on Sept. 7, 2022, 1:05 a.m.