Send Email Using R-Program
Using mailR & GMail
To send email using the R programming language we will need to install the “mailR” package and have a GMail account from Google. We will also use Googles smtp server to send the message.
In this article I assume you already have R and RStudio installed on your computer, and a Gmail account if you do not already have a Gmail account, you can sign up here. If you do not already have R and RStudio installed I have another article showing you the easy steps to do so here.
If you do not already have “mailR” installed, run the following in your RStudio Console.
install.packages("mailR")
Use the code below either as a R script or run it in the RStudio console to send email. Just replace the ‘your_email’ value with your actual Gmail account, the ‘recipient_email’ with your recipient email address and ‘your_email_password’ with the password of your Gmail account.
#install.packages("mailR")
library(mailR)
sender <- "your_email@gmail.com"
recipients <- c("recipient_email@gmail.com")
send.mail(from =…