我正在尝试将 R 创建的 JPEG 图像嵌入到电子邮件中,目的是创建一封自动显示的每日电子邮件,其中显示带有动态文本的图表。我能够附上图像,并指定竞争 ID;但是,当我发送消息并在 Outlook 中打开结果时,我会得到一个问号,图像应该在哪里。该图像确实成功地附加到了电子邮件,看起来图像只是没有在 HTML 中内联呈现。
这是我的示例代码:
library(mailR)
send.mail(from = "xx@xxx.com",
to = "xxx@xxx.com",
subject = paste("Results for the date ending ", Sys.Date()-1, sep = ""),
body = '<html> Test image - <img src="cid:test_img.jpg" /></html>',
html = TRUE,
smtp = list(host.name = "xxx.xxx.com", user.name = "xxx@xxx.com", passwd = "xxx"),
attach.files = '/Users/xxx/Documents/Rplots/test_img.jpg',
authenticate = TRUE,
inline = TRUE,
send = TRUE)
关于发生了什么的任何想法?