Code is as follows, The email, password and host name are correct
library(mailR)
library(rJava)
sender <- "sender@email"
recipients <- c("recipient@email")
send.mail(from = sender,
to = recipients,
subject="Subject of the email",
body = "Body of the email",
smtp = list(host.name = "smtp.office365.com", port = 587,
user.name="sender@email", passwd="password", ssl=F,tls = TRUE),
authenticate = T,
send = TRUE,
debug = T)
The debug produces
DEBUG SMTP: protocolConnect login, host=smtp.office365.com, user=sender@email, password=<non-null>
DEBUG SMTP: Attempt to authenticate using mechanisms: LOGIN PLAIN DIGEST-MD5 NTLM XOAUTH2
DEBUG SMTP: Using mechanism LOGIN
DEBUG SMTP: AUTH LOGIN command trace suppressed
DEBUG SMTP: AUTH LOGIN failed
This is to replace some code using RDCOMClient as the package is failing to install.