Fred J.
Fred J.

Reputation: 6029

email a html page report for printing

After downloading a page from the web using HTTP, this Meteor server code using "email 1.1.16 package" sends that page over to my email successfully but I receive the row html string.

It is a report which I wish to view and maybe print, it would be nice if it is a pdf attachment so that I can just click to open it, or be able to view the page in a different tab.
how can I go about fixing this problem? Thanks

Email.send({
        to: "[email protected]",
        from: "[email protected]",
        subject: "My report",
        text: rowHtml
      });

edit
After ready Vasil's answer, the Blaze.toHTML "Renders a template or View to a string of HTML".
But I already have a html string, why do I need to convert it to html string again?.

Upvotes: 1

Views: 51

Answers (2)

Fred J.
Fred J.

Reputation: 6029

All what I had to do is to change the line text: rowHtml to html: rowHtml according to the docs

Email.send({
    to: "[email protected]",
    from: "[email protected]",
    subject: "My report",
    html: rowHtml
  });

Upvotes: 0

Vasil Nedyalkov
Vasil Nedyalkov

Reputation: 65

var html = Blaze.toHTML(Blaze.With(data, function() { return Template.my_template; }));
Email.send({
        to: "[email protected]",
        from: "[email protected]",
        subject: "My report",
        text: html
      });

Using dynamic HTML templates in Meteor emails

Upvotes: 0

Related Questions