3

I'm running rstudio server in a docker container, hadleyverse, running on top of Ubuntu I would like to be able to send an email from there. I tried following this tutorial and wrote this code:

#Load library
library(sendmailR)

#Set mail options (i.e., port number)
sendmail_options(smtpPort=25)

#Send notification and results
sendmail(from="R notification", 
         to="MY@EMAIL.COM", 
         msg="test", 
         subject="R script has finished")

But I get the following error

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

Thanks for the help!

Ignacio
  • 7,646
  • 16
  • 60
  • 113
  • If you have no SMTP server running inside of the container, then you should provide the host etc. of the server you'd like to use with `sendmail`. It can be e.g. gmail or the parent host. – daroczig Apr 02 '15 at 17:41
  • is installing sendmail in the container a simple alternative? if i go the gmail route how do i set me credentials? Thanks! – Ignacio Apr 02 '15 at 21:02
  • It depends if you are better with sysadmin tasks or reading R docs :) – daroczig Apr 02 '15 at 23:15

0 Answers0