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

Bos, Roger roger.bos at rothschild.com
Fri Oct 9 14:55:28 CEST 2015


Michael,

I use sendmailR to attached a file to an email and it does work.  I remember there was something non-intuitive when I was figuring it out.  I use both the attachPath and the attachName.  The attachPath has the full path including the filename and the attachName just has the filename.  I don't why it wants the filename in both parameters, but it works for me.

emailR(to = "someone at email.com", subject = "Morning Notes", msg = msg, attachPath = newwd %+% fnameNotes, attachName = fnameNotes)

> fnameNotes
[1] "morningNotes_20151009.html"
> newwd %+% fnameNotes
[1] "//rinnycs0051/research/R_HOME_Research/Markdown/morningNotes/morningNotes_20151009.html"
> fnameNotes
[1] "morningNotes_20151009.html"

Thanks,

Roger







***************************************************************
This message and any attachments are for the intended recipient's use only.
This message may contain confidential, proprietary or legally privileged
information. No right to confidential or privileged treatment
of this message is waived or lost by an error in transmission.
If you have received this message in error, please immediately
notify the sender by e-mail, delete the message, any attachments and all
copies from your system and destroy any hard copies.  You must
not, directly or indirectly, use, disclose, distribute,
print or copy any part of this message or any attachments if you are not
the intended recipient.


-----Original Message-----
From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Michael Ashton
Sent: Thursday, October 08, 2015 5:24 PM
To: Frans Marcelissen
Cc: r-help at r-project.org
Subject: Re: [R] Attaching a pdf file to an email generated with sendmailR?

No particular reason for sendmailR...I will try mailR and thanks!



On Oct 8, 2015, at 4:49 PM, Frans Marcelissen <fransiepansiekevertje at gmail.com<mailto:fransiepansiekevertje at gmail.com>> wrote:

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<http://host.name> = "smtp.XXXXX", port = XXXXX, user.name<http://user.name> = "XXXXX", passwd = "XXXXX", ssl = XXXXX)

2015-10-08 18:49 GMT+02:00 Michael Ashton <m.ashton at enduringinvestments.com<mailto: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<http://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}}

______________________________________________
R-help at r-project.org<mailto:R-help at r-project.org> mailing list -- To UNSUBSCRIBE and more, see 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.


________________________________
This email and any attachments are confidential and intended only for the recipient noted above. You are hereby notified that any use, printing, copying or disclosure is strictly prohibited without the permission of Enduring Investments LLC. For further information please contact: Management at EnduringInvestments.com; (973) 457-4602.

        [[alternative HTML version deleted]]

______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see 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