2

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.

jg123
  • 23
  • 1
  • 4
  • Have you tried a different host, e.g. gmail? to see if you are getting a similar issue? This may be caused by your internet connection, your specific machine, etc. I had some issues with mailR recently too. See comments here: https://stackoverflow.com/questions/69001770/r-cannot-send-mail-to-outlook-via-mailr – Skaqqs Jan 06 '22 at 13:56

0 Answers0