Существуют разные способы, см. этот обзор, например . Настройки SMTP для Outlook и Office365 можно найти здесь .
Введите свои учетные данные в следующем фрагменте, и он должен работать сразу:
install.packages("remotes")
library(remotes)
remotes::install_github("datawookie/emayili")
install.packages("magrittr")
library(magrittr)
library(dplyr)
library(emayili)
msg <- envelope() %>%
from("you@email.net") %>%
to("me@outlook.com") %>%
subject("Test email subject") %>%
attachment("./yourFile.txt") %>%
text("Test email body")
smtp <- server(host = "smtp.office365.com",
port = 587,
username = "username",
password = "password")
smtp(msg, verbose = TRUE)