how to send html file in the body of the mail using R? -
i have html file result of rmarkdown code. need send email html file directly in body of email, , not in attachement. trying solution post: "send html email using r" post seems works html text , not html file. here i've tried do:
library(sendmailr) from<-"<sender@enterprise.lan>" to<-c("<reciever@enterprise.com>") message ="./test.html" subject = "test html" msg <- mime_part(message) msg[["headers"]][["content-type"]] <- "file/html" sendmail(from, to, subject, msg = msg,control=list(smtpserver="localhost"),headers=list("content-type"="file/html; charset=utf-8; format=flowed"))
this trial send me email "test.html" file attached, , not in body directly. i'm doing wrong, i'm struggling task days, can me, please?
try mailr
package send emails in html format follows:
send.mail(from = "sender@gmail.com", = c("recipient1@gmail.com", "recipient2@gmail.com"), subject = "subject of email", body = "<html>the apache logo - <img src=\"http://www.apache.org/images/asf_logo_wide.gif\"></html>", # can point local file (see next example) html = true, smtp = list(host.name = "smtp.gmail.com", port = 465, user.name = "gmail_username", passwd = "password", ssl = true), authenticate = true, send = true)
Comments
Post a Comment