ben
ben

Reputation: 799

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 <- "<[email protected]>"
to <- "<[email protected]>"
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.

Upvotes: 0

Views: 135

Answers (1)

MrFlick
MrFlick

Reputation: 206243

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)

Upvotes: 1

Related Questions