I have a webpage (using angular and some javascript) that requests data from a server and displays as a table.
I would like to send a copy of this webpage by email, (using node and nodemailer).
I use a http.get to get the html of the webpage, however naturally this only gets me the HTML. I would like to get the page as shown in the browser (after loading has completed) into the email.
How would I accomplish this?
This is my own attempt that naturally only works with a pure html page, and so lacks the javascript and the angular stuff. Please note that this uses coffeescript.
nodemailer = require("nodemailer")
http = require 'http'
sendmail = (html)->
transport = nodemailer.createTransport("SMTP",{
service: "Gmail"
auth:
user: u
pass: p
})
mailOptions =
from: f
to: t
subject: s
html: html
transport.sendMail mailOptions, (err,res)->
console.log err if err?
do transport.close
http.get 'http://localhost:3000/something', (res) ->
res.on 'data', (data) ->
sendmail data.toString()