[R] Attaching a pdf file to an email generated with sendmailR?

Michael Ashton m.ashton at enduringinvestments.com
Thu Oct 8 18:49:17 CEST 2015


For some time I have been using sendmailR to generate a simple message when a report was done running.

Recently, I started adding a couple of pertinent statistics in the body of the email.

Now, I've finally decided that what the heck, I ought to simply attach the report itself to the email. The report is generated as a pdf file.

I can't seem to get this to work in any simple way with mime_part; if I specify a path to the file it simply assumes that "P:/blablabla/thefile.pdf" is a message I want to put in a text file attachment.

I assume I am doing something incorrectly and likely something simple. But maybe there is a clever trick I am missing. My send line is simply:

sendmail(from,to,subject,body,control=list(smtpServer="mail.optonline.net"))

where body is something like this:

body <- list("Here's your stupid file",mime_part(x="P:/partofpath/ thefile.pdf",name="file.pdf"))

Any suggestions are welcome!

Thanks,

Mike

________________________________
This email and any attachments are confidential and inte...{{dropped:9}}



More information about the R-help mailing list