小编Krb*_*rby的帖子

电子邮件内嵌图片R

我正在尝试在R中发送带有2个附件的电子邮件,其中一个是我要内嵌显示的图片

我可以成功发送带有两个附件的电子邮件,但是在以内嵌方式显示时会遇到麻烦。

任何想法将不胜感激

当前代码:

setwd(<filepath>)

library(sendmailR)
library(png)


##### SET BASIC EMAIL CHARACTERISTICS

from <- "me@gmail.com"
to <- "them@gmail.com"
subject <- "Sales report"


##### PREPARE ATTACHMENT

# put the body and the mime_part in a list for msg
# x = needs full path if not in working directory
# name = same as attachmentPath if using working directory
attachmentObject <-  mime_part(x="spreadsheet.xlsx",name="spreadsheet.xlsx") 
attachmentObject2 <- mime_part(x="graph.png",name="graph.png")


body <- c("Generic body text", <graph attachmentObject2>)
bodyWithAttachment <- list(body,attachmentObject,attachmentObject2)


##### SEND EMAIL

sendmail(from=from,
         to=to,
         subject=subject, …
Run Code Online (Sandbox Code Playgroud)

email png r

4
推荐指数
1
解决办法
1156
查看次数

标签 统计

email ×1

png ×1

r ×1