[R] Sending Email from R
Lopez, Dan
lopez235 at llnl.gov
Thu Feb 21 01:09:13 CET 2013
David,
Yes, sorry, I sent the version of this were I was playing with trying to get two sets of text in the body. You are right:
body <- list("It works!", mime_part(iris) )
But that doesn't address my original problem with trying to get dput() into email from R. I mean I can copy and paste as I usually do but just thought there is an easy way to do it through sendmail.
Thanks.
Dan
-----Original Message-----
From: David Winsemius [mailto:dwinsemius at comcast.net]
Sent: Wednesday, February 20, 2013 4:06 PM
To: Lopez, Dan
Cc: R help (r-help at r-project.org)
Subject: Re: [R] Sending Email from R
On Feb 20, 2013, at 2:21 PM, Lopez, Dan wrote:
> David
>
> Thanks for the other resources. But I think those don't solve my problem.
>
> FYI I used sendmailR:sendmail without password.
>
> This is more or less how I ended up doing it. I can send a simple plain email or a simple plain email with an attachment or few attachments. Not sure if it makes a difference but in this test I am sending to myself from within the company
>
> I am just trying to figure out how to email the contents from dput(). Whenever I try it prints it to the screen and the contents don't appear in the email at all: body or attachment. If I try it as an attachment (that's the mime_part()) the attachment is blank.
>
> ## Not run:
> from <- "lopez235 at llnl.gov"
> to <- "lopez235 at llnl.gov"
> subject <- "This email from R"
> body <- list("It works!", "mime_part(iris)")
Shouldn't that be :
body <- list("It works!", mime_part(iris) ) # ???
>
> mailControl=list(smtpServer="thing.thing.gov")
>
> sendmail(from=from,to=to,subject=subject,msg=body,control=mailControl)
> ## End(Not run)
>
> Thanks.
> Dan
>
>
> -----Original Message-----
> From: David Winsemius [mailto:dwinsemius at comcast.net]
> Sent: Wednesday, February 20, 2013 11:59 AM
> To: David Winsemius
> Cc: Lopez, Dan; R help (r-help at r-project.org)
> Subject: Re: [R] Sending Email from R
>
>
> On Feb 20, 2013, at 10:44 AM, David Winsemius wrote:
>
>>
>> On Feb 20, 2013, at 10:24 AM, Lopez, Dan wrote:
>>
>>> Hi R experts,
>>>
>>> I know how to send simple plain text message in body and how to send with attachments. This is thanks to stackoverflow reference below.
>>>
>>> But I don't know how to send dput() output in the body of the email (or attachment) using sendmailR. I more interested in figuring out how to include it as part of the body of the email.
>>>
>>> Does anybody have experience on how to do this?
>>>
> http://stackoverflow.com/questions/2885660/how-to-send-email-with-attachment-from-r-in-windows
>
>>> #?sendmailR::sendmail
>>>
>>> library(sendmailR)
>>>
>>> #set working directory
>>> setwd("C:/workingdirectorypath")
>>>
>>> #####send plain email
>>>
>>> from <- "you at account.com"
>>> to <- "recipient at account.com"
>>> subject <- "Email Subject"
>>> body <- "Email body."
>>> mailControl=list(smtpServer="serverinfo")
>>>
>>> sendmail(from=from,to=to,subject=subject,msg=body,control=mailControl)
>>
>> Does this mean you get success with the simple example you posted?
>
> This might be critical. There was a 2010 posting from Barry Rowlingson saying that 'sendmail' in sendmailR was unable to provide smtp-authorization. I got an error message regarding authorization when I added my password.
>
> http://markmail.org/search/?q=list%3Aorg.r-project.r-help+sendmail+authentication#query:list%3Aorg.r-project.r-help%20sendmail%20authentication+page:1+mid:pwfqwwwumgwtcqx7+state:results
>
> That thread also included Ben Bolker's offer of code in package:Rmail at:
>
> http://www.math.mcmaster.ca/~bolker/R/src/contrib/
>
>
> I was able to get Lin Himmelmann's mail::sendmail function to send a message to myself. Looking at the code it appears Lin has set up a PHP server and is parsing an http: request. It also doesn't look like it is intended to be general solution since there is a message saying the numbers of messages are limited.
>
> --
>
> David Winsemius
> Alameda, CA, USA
>
David Winsemius
Alameda, CA, USA
More information about the R-help
mailing list