| send_mail {curl} | R Documentation |
Use the curl SMTP client to send an email. The message argument must be
properly formatted RFC2822 email message with From/To/Subject headers and CRLF
line breaks.
send_mail(mail_from, mail_rcpt, message, smtp_server = "localhost", use_ssl = FALSE, verbose = TRUE, ...)
mail_from |
email address of the sender. |
mail_rcpt |
one or more recipient email addresses. Do not include names,
these go into the |
message |
either a string or connection with (properly formatted) email message, including sender/recipient/subject headers. See example. |
smtp_server |
address of the SMTP server without the |
use_ssl |
connect with the smtp server over TLS. Gmail requires this. |
verbose |
print output |
... |
other options passed to |
# Message in RFC2822 format
message <- 'From: "Testbot" <jeroen@ocpu.io>
To: "Jeroen Ooms" <jeroenooms@gmail.com>
Subject: Hello there!
Hi Jeroen,
I am sending this email using curl.'
# Actually send the email
recipients <- c('test@opencpu.org', 'jeroenooms@gmail.com')
sender <- 'test@ocpu.io'
username <- 'mail@ocpu.io'
password <- askpass::askpass(paste("SMTP server password for", username))
send_mail(sender, recipients, smtp_server = 'smtp.mailgun.org',
message = message, username = username, password = password)