Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

195
Visualizações
Enviar correo usando nodemailer html como renderizar jade en el correo - nodeJS

Recibo el siguiente error mientras ejecuto

Error: no se pudo buscar la vista "índice" en el directorio de vistas "C:\TFS\tambola-generator-master♂iews" en Function.render (C:\TFS\tambola-generator-master\node_modules\express\lib\application. js:580:17) en ServerResponse.render (C:\TFS\tambola-generator-master\node_modules\express\lib\response.js:1017:7) en C:\TFS\tambola-generator-master\server. js:104:7 en Layer.handle [como handle_request] (C:\TFS\tambola-generator-master\node_modules\express\lib\router\layer.js:95:5)

Código

 app.get('/', function (req, res) { var tickets = tambola.default.generateTickets(1); tickets.map(t => t._entries).forEach(element => { element.filter(function(e){return e}); var smtpTransport = nodemailer.createTransport(({ host: 'smtp.zoho.com', // secureConnection: true, // use SSL port: 465, secure:true, requireTLS:true, auth: { user: 'xxx', pass: 'ccc' } })); data = element; config = { columns: { 0: { width: 5 // Column 0 of width 1 }, 1: { width: 5 // Column 1 of width 20 }, 2: { width: 5 // Column 2 of width 5 }, 3: { width: 5 // Column 2 of width 5 }, 4: { width: 5 // Column 2 of width 5 }, 5: { width: 5 // Column 2 of width 5 }, 6: { width: 5 // Column 2 of width 5 }, 7: { width: 5 // Column 2 of width 5 }, 8: { width: 5 // Column 2 of width 5 } } } var readHTMLFile = function(path, callback) { fs.readFile(path, {encoding: 'utf-8'}, function (err, html) { if (err) { callback(err); throw err; } else { callback(null, html); } }); }; readHTMLFile(__dirname + '/Views/index.html', function(err, html) { var template = jade.compile(html); var replacements = { username: "John Doe" }; var htmlToSend = template(replacements); var mailOptions = { from: 'xxx', to: 'ccccc', subject : 'test subject', html : htmlToSend }; smtpTransport.sendMail(mailOptions, function (error, response) { if (error) { console.log(error); callback(error); } }); }); }); var sequence = tambola.default.getDrawSequence(); res.render('index',{tickets: tickets.map(t => t._entries)}); });

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda