简体   繁体   中英

How to avoid `"msg" is missing` error using sendmail in R?

When I try to use sendmail from the sendmailR package in R, I am getting this error:

Error in .smtp_submit_mail(server, port, headers, msg, verbose) : argument "msg" is missing, with no default

Here is the code I am trying to execute:

library(sendmailR)
from <- "<some.address@gmail.com>"
to <- "<some.address@gmail.com>"
subject <- "this subject"
body <- "this text right here"
mailControl <- list(smtpServer = "ASPMX.L.GOOGLE.COM")
sendmail(from = from, to = to, subject = subject,
                  body = body, control = mailControl)

This is essentially the same code that can be found in online tutorials.

The parameter for the body of the email is called msg , not body . Use

sendmail(from = from, to = to, subject = subject,
                  msg = body, control = mailControl)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM