I want to send emails from R. This is what I have so far:
library(sendmailR)
from <- \"eamil@example.com\"
to <- \"email2@example.com\"
subject <-
There are two ways to send an email via Gmail, anonymized or authenticated. Here is the code for anonymized:
library(mailR)
send.mail(from = "sender@gmail.com",
to = c("Recipient 1 ", "recipient2@gmail.com"),
cc = c("CC Recipient "),
bcc = c("BCC Recipient "),
subject = "Subject of the email",
body = "Body of the email",
smtp = list(host.name = "aspmx.l.google.com", port = 25),
authenticate = FALSE,
send = TRUE)
Make sure the recipient emails are Gmail too. It most likely goes to the spam folder in the Gmail account so make sure to mark it "not spammed".
You can find more info here.