Sending email from R in AWS

Viewed 515

I am trying to send myself a test email from an AWS Virtual Machine (using an EC2 instance.)

My R code runs great, but I am now trying to send a test email to my email address using sendmailR.

I get the following error message:

Error in socketConnection(host = server, port = port, blocking = TRUE) : cannot open the connection In addition: Warning message: In socketConnection(host = server, port = port, blocking = TRUE) : localhost:25 cannot be opened

 install.packages("sendmailR")
 library(sendmailR)

 sendmail(from = "XXXX@gmail.com",
      to = "YYYY@gmail.com",
      subject = "Subject of the email",
      body = "Body of the email",
      smtp = list(host.name = "smtp.gmail.com", port = 80 , user.name = "XXXX@gmail.com", passwd = "XXXX", ssl = TRUE),
      authenticate = TRUE,
      send = TRUE)

Does anyone know how this is overcome?

0 Answers
Related