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.
From your inbox, select the email you want to attach. Drag the email into your message. At the bottom, click Send.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With