Still get the same error, maybe the issue comes from jsreport itself, or configuration???
Posts made by Tan Tran
-
RE: Jsreport with nodemailer-express-handlebars
-
RE: Jsreport with nodemailer-express-handlebars
Hi jan_blaha,
Actually I need to send an HTML email with some parameters and attachments, I used the example and it worked perfectly. But I need a more complex HTML email, so that I need someway to read the external file from the script. Currently, I solved the problem with built-in html feature of nodemailer, but it is not a good practice. Do you know how to read file from script? Thanks in advance -
RE: Jsreport with nodemailer-express-handlebars
I think that the error is not that of trying to read directory instead for a file. I have also tried fs to read file to test but still get the same error, despite the fact that the path is correct. Do you have an example of reading a file from script? Thanks in advance.
-
RE: Jsreport with nodemailer-express-handlebars
I tried the example here "https://writejavascript.com/blog/sending-emails-with-node/". I set up the structure of directory as shown in the code and it can access the directory but always yield error: Error: EISDIR: illegal operation on a directory, read. The code as shown below:
function afterRender(req, res, done) { console.log('After rendered report.....................'); console.log(req.data); var mailer = require("nodemailer"); var hbs = require("nodemailer-express-handlebars"); var smtpTransport = mailer.createTransport({ host : "mail.xxx.no", port : 465, secure: true, auth : { user : "noreply@xxx.no", pass : "xxx" }, tls : { rejectUnauthorized: false } }); var options = { viewEngine : { extname: ".hbs", partialsDir: './data/etakeaway/Invoice/views', layoutsDir: './data/etakeaway/Invoice/views/layouts' }, viewPath : './data/etakeaway/Invoice/views', extName: ".hbs" }; smtpTransport.use('compile', hbs(options)); var mail = { from: "XXX <noreply@xxx.no>", to: req.data.email, subject: "Receipt for order id " + req.data.orderId, text: "See the attached report", template: 'template', context: { name : 'Name', orderId : '#123456' }, attachments: [ { filename: 'Receipt.pdf', content: new Buffer(res.content) }], } smtpTransport.sendMail(mail, function(error, response){ smtpTransport.close(); if(error){ return done(error); } return done(); }); }
-
RE: Jsreport with nodemailer-express-handlebars
I have also tried fs to read the file, but got the same error???
-
Jsreport with nodemailer-express-handlebars
I use jsreport with nodemailer and nodemailer-express-handlebars to create html email. However in the afterRender script, the script could not access template.handlebar when configuring, it always yield an error: Error: EISDIR: illegal operation on a directory, read. Do anyone how can I access file from script?
Thanks in advance