Add the default e-mail logger
addDefaultEmailLogger(
mailSettings,
label = Sys.info()["nodename"],
name = "DEFAULT_EMAIL_LOGGER",
test = FALSE
)
Arguments to be passed to the sendmail
function in the sendmailR
package (except
subject and msg).
A label to be used in the e-mail subject to identify a run. By default the name of the computer is used.
A name for the logger.
If TRUE, a message will be displayed on the console instead of sending an e-mail.
Creates a logger that writes to e-mail using the "FATAL" threshold and the
layoutEmail
layout. This function uses the sendmailR
package. Please make sure
your e-mail settings are correct by using the sendmailR
package before using those settings here.
ParallelLogger
will not display any messages if something goes wrong when sending the e-mail.
To use a GMail account, make sure to enable 2-step verification on your
Google account (see 'Security'). Click on 2-Step Verification, and
scroll down to 'App passwords'. Here, you can create an app-specific password
to be used with ParallelLogger
. You can set
host.name = "smtp.gmail.com:587"
, and be sure to use
engine = "curl"
.
mailSettings <- list(
from = "someone@gmail.com",
to = "someone_else@gmail.com",
engine = "curl",
engineopts = list(
username = "someone@gmail.com",
password = "Secret!"
),
control = list(
host.name = "smtp.gmail.com:587"
)
)
# Setting test to TRUE in this example so we don't really send an e-mail:
addDefaultEmailLogger(mailSettings, "My R session", test = TRUE)
#> Error: ‘sendmailR’ must be installed for this functionality.
logFatal("Something bad")
unregisterLogger("DEFAULT_EMAIL_LOGGER")
#> Warning: Could not find logger DEFAULT_EMAIL_LOGGER
#> [1] FALSE