[R] Sending Email with Attachment

Bhupendrasinh Thakre vickythakre at gmail.com
Mon Jun 10 06:06:55 CEST 2013


Thanks Rex for the help. So it seems that I might have to use Python or Perl
to perform the action.



-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of rex
Sent: Sunday, June 09, 2013 10:27 PM
To: r-help at r-project.org
Subject: Re: [R] Sending Email with Attachment

Bhupendrasinh Thakre <vickythakre at gmail.com> [2013-06-09 20:03]:
>
>library("sendmailR")
>
>from <- "abcd at outlook.com"
>to <-  <mailto:efgh at gmail.com> efgh at gmail.com subject <- "Run at"
>mailControl = list(smtpServer="blu-m.hotmail.com")
>attachment <- "type_1.pdf"
>attachmentName <- "target_score.pdf"
>attachmentObject <- mime_part(x= attachment,name= attachmentName) body 
><- "Email Body"
>bodywithAttachement <- list(body, attachmentObject) 
>sendmail(from=from,to=to,subject=subject,msg=
>bodywithAttachement,control=mailControl)
>
>However it gives me following Error:
>
>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) :
>  blu-m.hotmail.com:25 cannot be opened

It's an unsurprising result since telnet doesn't connect either:
  
telnet blu-m.hotmail.com 25
Trying 65.55.121.94...
telnet: Unable to connect to remote host: Connection timed out

Try port 443:

telnet blu-m.hotmail.com 443
Trying 65.55.121.94...
Connected to eas-blu.hot.glbdns.microsoft.com.
Escape character is '^]'.

But it's probably expecting TLS, and sendmailR doesn't support it.

>Please let me know if we have some solution for this.

If you want to use sendmailR, you need to find a mail server that does not
require TLS. This may mean running your own mail server. 

Or, you can call an external program that handles a TLS connection.

-rex
--
Proofread carefully to see if you any words out.

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list