Skip to content

Instantly share code, notes, and snippets.

@verajosemanuel
Created May 17, 2019 10:16
Show Gist options
  • Save verajosemanuel/7595121de15d3d9f3f66ebb7f3c33f01 to your computer and use it in GitHub Desktop.
Save verajosemanuel/7595121de15d3d9f3f66ebb7f3c33f01 to your computer and use it in GitHub Desktop.
#mail #error in #R
options(error = function() {
subject.msg <- paste0("Error Subject, ", format(Sys.time(), "%A %d %B %Y %X"))
from <- "sender@mail"
body <- geterrmessage()
mailControl = list(smtpServer = "mail.server.com", smtpPort = "25")
sendmail(from = from,
to = c("[email protected]","[email protected]"),
subject = subject.msg,
msg = body,
control = mailControl)
flog.error(geterrmessage())
traceback()
stop()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment