我无法以 UTF-8 格式获取电子邮件的正文。我的降价报告没问题,并且脚本在运行时有效RStudio
- 即正文为 UTF-8。我的问题是,当我从命令行运行脚本时,我的电子邮件是使用 windows-1252 编码的,而我并不真正想要。
如何设置我的代码以将我的电子邮件标头指定为内容类型为 UTF-8?InternetCodepage 至少不起作用
R代码如下:
## Bodytext
bodyMail <- paste(__My UTF-8 message goes here__, sep = "")
# init com api
OutApp <- COMCreate("Outlook.Application")
# Create email
outMail = OutApp$CreateItem(0)
# Params
outMail[["InternetCodePage"]] = "65001"
outMail[["To"]] = __your_outlook_email___
outMail[["subject"]] = "Subject_text"
outMail[["BodyFormat"]] = "2"
outMail[["HTMLBody"]] = bodyMail
outMail[["Attachments"]]$Add(__path_to_html_report__)
## send it
outMail$Send()