首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >sendmailR (Part2):将文件作为邮件附件发送

sendmailR (Part2):将文件作为邮件附件发送
EN

Stack Overflow用户
提问于 2010-08-26 14:39:59
回答 4查看 14.7K关注 0票数 22

按照this相关问题中提供的说明,我能够发送html格式的邮件消息。现在的问题是:我应该如何修改下面的代码,以便将一个或多个文件(任何类型)附加到此消息?

library(sendmailR)

from <- "<sendmailR@myserver.mycompany.com>"
to <- c("<someone@mycompany.com>","<anotherone@mycompany.com>")
subject <- iconv("Message Title", to = "utf8")

msg <- "<hr size='2' width='33%' style='text-align: left;'><font size='2'>
  <i>This email was sent automatically using <a href='http://finzi.psych.upenn.edu/R/library/sendmailR/html/00Index.html' rel='nofollow' target='_blank'>sendmailR</a>.<br>
  Please do not reply directly to this e-mail.</i></font>"

msg <- iconv(msg, to = "utf8")

sapply(to,function(x) sendmail(from, x, subject, msg, control=list(smtpServer="###.###.###.###"), headers=list("Content-Type"="text/html; charset=UTF-8; format=flowed")))
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3572607

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档