我知道这可以通过 python 实现。但是,我想知道是否有办法用 R 来做到这一点。代码片段将不胜感激。
问问题
50 次
1 回答
1
有多种方法,例如参见此概述。可在此处找到Outlook 和 Office365 的 SMTP 设置。
在以下代码段中填写您的凭据,它应该可以立即工作:
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)
于 2020-03-17T11:13:29.440 回答