Paste gvis object (image saved as HTML) as embedded in mailR - R

I am working on a googleVis diagram and want to insert a gvis object (image stored as HTML) as inline using the mailR package.

I have the code below to send mail from my server -

 library(mailR) send.mail(from = " admin_xxx@apsmail.xx.xxx.xx ", to = c(" first.second@jba.com "), subject = paste("Batch Job Stats on",now), body = paste("Dear Sir/Madam,<br><br> Please find below the image",".<br><br>", "<img src=\"D:/xx/Batch_Processing/Batch_Processing_Run/Rplot1.png\">",".<br><br>" ), html = TRUE,inline = TRUE, smtp = list(host.name = "xxxx01.xxx.xxx.xx"), authenticate = FALSE, send = TRUE) 

The above code works fine - and I embed the image (present on my serverโ€™s D drive)

Now I use googleVis to create charts and save them in an html file. (present on drive D of my server)

 Gauge <- gvisGauge(CityPopularity, options=list(min=0, max=800, greenFrom=500, greenTo=800, yellowFrom=300, yellowTo=500, redFrom=0, redTo=300, width=400, height=300)) plot(Gauge) print(Gauge, tag="chart", file="test1.html") 

So now my question is that I canโ€™t insert my .html file (created using the above code - test1.html ) to send email with googleVis graphic embedded in the body of the mail description. (I could not save the gvis -Chart object as .png). I saw a solution - similar to this in SO, but it does not help me.

+6
source share
1 answer

if you accidentally open "tmp.html" as an entry (that is, the location speaks of documents: //*/tmp.html), then a security warning may occur. You need to get to html via http: //.

Thus, if it is impossible to change any page of the website on which the tag is available (for example, a blogger), you can use it mainly to duplicate and glue the tmp.html substance similar to this:

http://takahashik.blogspot.com/2011/01/googlevis-example.html

here is the famous iris shape:

http://takahashik.blogspot.com/2011/01/googlevis-case for-information iris_10.html

Something else, in case you have a web server, you can use it by translating tmp.html to the server.

-1
source

Source: https://habr.com/ru/post/987178/


All Articles