我使用以下脚本发送电子邮件。可以。
library(mailR)
myfrom<-"from@example.com"
mysmtp<-"smtp.example.com"
mysmtpport<-25
myusername<-"emailfromusername"
mypassword<-"emailaccountpassword"
myemailsubject<- "The Subject"
myemailcontent="content of the email"
emailto<-"emailto@example.com"
send.mail(from = myfrom,
to = emailto,
replyTo= myfrom,
subject = myemailsubject,
body = emailbody,
html = TRUE,
encoding="utf-8",
smtp = list(host.name = mysmtp, port = mysmtpport, user.name = myusername, passwd = mypassword, ssl = FALSE,tsl= FALSE),
authenticate = TRUE,
send = TRUE)
但是,如果我在myfrom中插入一些汉字,就像myfrom <-“大家好
我尝试过:
myfrom<-"大家好 < from@example.com >"
Encoding(myfrom)<-"utf-8"
还是没用。如何正确显示这些汉字?有什么建议么?谢谢。