How to send HTML email using R

前端 未结 5 936
慢半拍i
慢半拍i 2020-12-16 02:44

I have searched SO and well as google and cannot seem to find a solution to my problem. I am trying to send a HTML formatted email within R using sendmailR package. The plai

5条回答
  •  我在风中等你
    2020-12-16 03:10

    sendmailR cannot do this because it is hard-coded to send the message part out as text. If you look at the packages source, line 38 of sendmail.R is the following:

    writeLines("Content-Type: text/plain; format=flowed\r\n", sock, sep="\r\n")
    

    Change that to

    writeLines("Content-Type: text/html; format=flowed\r\n", sock, sep="\r\n")
    

    like you tried to do through the options and it will work.

    Update: sendmailR now allows html emails (see Karl's answer below and https://stackoverflow.com/a/21930556/448145).

提交回复
热议问题