How easy is it to send e-mail through R?
> from <- "email@example.com"
> to <- "firstname.lastname@example.org"
> subject <- "Performance Result"
> body <- "This is the result of the test:"
> mailControl=list(smtpServer="snmpt server address")
Error in wait_for(code) :
SMTP Error: 5.5.2 Syntax error. jp9si1521863wjb.204 - gsmtp
sender <- "email@example.com" # Replace with a valid address
recipients <- c("firstname.lastname@example.org") # Replace with one or more valid addresses
email <- send.mail(from = sender,
to = recipients,
subject="Subject of the email",
body = "Body of the email",
smtp = list(host.name = "aspmx.l.google.com", port = 25),
authenticate = FALSE,
send = FALSE)
It works for me with slightly different smtp settings (host name, port and ssl and addition of user.name and passwd) and also with 'authenticate' and 'send' changed to TRUE.
library(mailR) send.mail(from = sender, to = recipients, subject = "Subject of the email", body = "Body of the email", smtp = list(host.name = "smtp.gmail.com", port = 465, user.name = sender, passwd = "senders_password", ssl = TRUE), authenticate = TRUE, send = TRUE)