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

Frans Marcelissen fransiepansiekevertje at gmail.com
Thu Oct 8 22:49:22 CEST 2015


Hi Michael,
I don't know whether there is a particulal reason for using sendmailR, but
I use mailR for this without any problem.
mailR::send.mail(from, to, subject = "", body = "", encoding = "iso-8859-1",
  html = FALSE, inline = FALSE, smtp = list(), authenticate = FALSE,
  send = TRUE, attach.files = NULL, debug = FALSE, ...)

If you use an external smtp server, enter login name and password in
parameter smtp as follows:
smtp = list(host.name = "smtp.XXXXX", port = XXXXX, user.name = "XXXXX",
passwd = "XXXXX", ssl = XXXXX)

2015-10-08 18:49 GMT+02:00 Michael Ashton <m.ashton at enduringinvestments.com>
:

> 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 in...{{dropped:13}}



More information about the R-help mailing list