createEmailAppender | R Documentation |
Create e-mail appender
createEmailAppender(
layout = layoutEmail,
mailSettings,
label = Sys.info()["nodename"],
test = FALSE
)
layout |
The layout to be used by the appender. |
mailSettings |
Arguments to be passed to the |
label |
A label to be used in the e-mail subject to identify a run. By default the name of the computer is used. |
test |
If TRUE, a message will be displayed on the console instead of sending an e-mail. |
Creates an appender that will send log events to an e-mail address using the sendmailR
package.
Please make sure your 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:
appender <- createEmailAppender(
layout = layoutEmail,
mailSettings = mailSettings,
label = "My R session",
test = TRUE
)
logger <- createLogger(name = "EMAIL", threshold = "FATAL", appenders = list(appender))
registerLogger(logger)
logFatal("Something bad")
unregisterLogger("EMAIL")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.