AfterRender with nodemailer bug
-
I have created a template that has a footer and also a script with afterRender function in order to send an email( the exact script provided here: https://jsreport.net/learn/periodical-report-sending-through-email#send-output-in-mail ) each time a report is rendered.
When I request a report, 2 emails are sent to the recipients provided, 1 with the exact report asked and the other with corrupted pdf.
If I remove the footer then only 1 report is sent with the correct report.
The same happens if instead of footer I add a header.
If I add both header and footer in a template then 3 emails are sent.I think that jsreport considers footer and header separate templates and that triggers the afterRender function.
Is there a way I can fix that that?
-
See docs
https://jsreport.net/learn/scripts#phantom-pdf-notefunction afterRender(req, res, done) { //filter out script execution for phantom header if (req.options.isChildRequest) return done(); //your script done(); }
-
Thank you very much.