title: mailR: how to send rmarkdown documents as body in email?
body: <p>How to send <code>rmarkdown</code> generated documents as a body in an email, using R?</p>
  
  <p>I have successfully tried <code>knitr</code> with <code>mailR</code>, but when instead generating the html-report with the  (new) <code>rmarkdown</code>-package it fails.</p>
  
  <pre><code>library(mailR)
  send.mail(
    from = "FROM@gmail.com",
    to = "TO@gmail.com",
    subject = "MyMail",
    html = T,
    inline = T,
    body = "my_report.html",
    smtp = list(host.name = "smtp.gmail.com", port = 465,
      user.name = "USERNAME", passed = "PASSWORD", ssl = T),
    authenticate = T,
    send = T
  )
  </code></pre>
  
  <p>error:</p>
  
  <pre><code>org.apache.commons.mail.EmailException: Building the MimeMessage failed
      at org.apache.commons.mail.ImageHtmlEmail.buildMimeMessage(ImageHtmlEmail.java:110)
      at org.apache.commons.mail.Email.send(Email.java:1436)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at RJavaTools.invokeMethod(RJavaTools.java:386)
  Caused by: java.io.IOException: Cant resolve the following file resource :/Users/USERNAME/myfolder/./data:image/png;base64,iVBORw0KGg …
  
  (…)
  
  … SuQmCC
      at org.apache.commons.mail.resolver.DataSourceFileResolver.resolve(DataSourceFileResolver.java:105)
      at org.apache.commons.mail.resolver.DataSourceFileResolver.resolve(DataSourceFileResolver.java:79)
      at org.apache.commons.mail.ImageHtmlEmail.replacePattern(ImageHtmlEmail.java:149)
      at org.apache.commons.mail.ImageHtmlEmail.buildMimeMessage(ImageHtmlEmail.java:103)
      ... 6 more
  Error: EmailException (Java): Building the MimeMessage failed
  </code></pre>
  
  <p>I guess it has to do with the following line: <strong>Cant resolve the following file resource :/Users/USERNAME/myfolder/./data:image/png;base64</strong>?</p>
  
  <p>I'm more than grateful for any kind of guidance.</p>