if (FALSE) {
lgr::AppenderSendmail$new(
to = "user@ecorp.com",
control = list(smtpServer = "mail.ecorp.com"),
from = "lgr_user@yourmail.com"
)
}
if (requireNamespace("sendmailR")){
# requires that you have access to an SMTP server
lg <- lgr::get_logger("lgrExtra/test/mail")$
set_propagate(FALSE)$
add_appender(AppenderSendmail$new(
from = "ceo@ecorp.com",
to = "some.guy@ecorp.com",
control = list(smtpServer = "mail.somesmptserver.com")
))
# cleanup
invisible(lg$config(NULL))
}
Run the code above in your browser using DataLab