Reputation: 1151
I am trying to attach a file from my system to send it to an email id using R. I am using the gmailr package to send the mails. I have tried the following code for the same.
library(gmailr)
mime() %>%
to("[email protected]") %>%
from("[email protected]") %>%
text_body("My First Email using R.") -> first_part
first_part %>%
subject("Test Mail from R") %>%
attach_file("BazaarQueriesforURLData.txt") -> file_attachment
send_message(file_attachment)
I have been able to send text based messages but I am unable to send attachments from R. My attachment in the default directory folder only.I have seen many solutions on internet but I am unable to find a solution.
I would like to have a solution that has proper OAuth or Json based authentication as Google blocked my attempt to use smtp based authentication.
Upvotes: 13
Views: 3212
Reputation: 3490
other tools are packages mailR https://cran.r-project.org/web/packages/mailR/mailR.pdf
and sendmailR
https://cran.r-project.org/web/packages/sendmailR/sendmailR.pdf
Here is a blog post tutorial
http://blog.yhat.com/posts/building-email-reports-with-r.html
Upvotes: 0
Reputation: 105
Here's a tool in development:
# install.packages("devtools")
library(devtools)
install_github("gmailR", "trinker")
*if you use Windows, you'll need to use Rtools and devtools to install
Upvotes: 1