0

I have trouble sending email with the packages sendmailR via Outlook. It work fine on my main computer (windows machine) but when I try it on my virtual machine running with Ubuntu 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) :
  MYADRESSE.local:25 cannot be opened

I used the following code that once again work fine on the host machine.

library(sendmailR)
from <- "myname@company.com"
to <- "myname@company.com"
subject <- "Performance Result"
body <- "This is the result of the test:"
mailControl=list(smtpServer="MYADRESSE.local")
sendmail(from=from,to=to,subject=subject,msg=body,control=mailControl)

Do I have to set up the virtual machine to access MYADRESSE.local? The network between the two (host and hosted) is set up to "bridge". My final goal would be to use shiny server to creat an app able to send emails through the main Outlook of the host, that for the moment, emails put aside work perfectly.

Romain
  • 440
  • 4
  • 17

1 Answers1

1

Outlook is mail client, so does sendmailR . I assume you mean, you send mail through your SMTP mail server that your outlook mail client also connect to.

First, check whether you can ping your SMTP mail server from virtual machine. The same SMTP mail server as your outlook.

Second, try telnet from VM ubuntu to your SMTP server e.g.

telnet your-smtp-server 22

If neither works, look for those question about connecting VM to your LAN.

(UPDATE) For your Windows machine to talk to MYADRESSE.local , there must be a setting in the host file. Go open c:\windows\system32\drivers\etc\hosts, and see whether there is a entry for it. If the entry show

127.0.0.1  MYADRESSE.local 

This mean you have a SMTP server setting in your windows system. If any other address, e.g. (just example, the address can be varied)

192.168.100.10  MYADDRESS.local

Then 192.168.100.10 is your SMTP server addresss . Then the ping , telnet work show above should use this IP address. e.g. telnet 192.168.100.10... And your SendMailR should use this IP address, not MYADDRESS.local

mootmoot
  • 12,845
  • 5
  • 47
  • 44
  • Hi thanks for your answer I am pretty new in all this VM thing so I will try to explain it as I can. First, the ping between the host and the VM work well as well as the internet connexion of the VM. If I run the command "ping -c 1 MYSERVER.local" I have ping : unknown host MYSERVER.local. Same with your command I have "could not resolve MYSERVER.local/22: Name or service not known". I may be doiing something very silly as I told you I am new at this kind of network thing. I also try tp check for connecting my VM to my LAN but all the try was vain (changes in the network settings). – Romain Apr 05 '16 at 15:48
  • This is network issue, NOT VM issue. VM is just like another machine, it doesn't matter it sit on the same machine. I will update my answer and tell you which mistake you made – mootmoot Apr 05 '16 at 16:29
  • Thank you very much. Work perfectly fine this way! – Romain Apr 05 '16 at 16:42