Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

364
Views
No se puede enviar un archivo desde Vue.js usando Axios to Express para enviarlo por correo electrónico adjunto (nodemailer)

Tengo un front-end en Vue.js y estoy usando AXIOS para enviar datos al back-end. Necesito enviar algunos datos y un archivo PDF (generado con jsPDF API). Sin embargo, el backend no recibe el archivo. ¿Qué estoy haciendo mal? Cualquier ayuda sería realmente apreciada.

código generador.vue

 this.doc = new jsPDF({orientation: "p", unit: "pt", format: "a4"}) // ... doing staff to create the PDF file here... everything is done properly var file = this.doc.output('url'); this.$axios.post(`/sendmail/`, { "toEmail": "xxx@gmail.com", "bccEmail": "", "patientName": "Maria", "studyType": "Abdominal", "attachmentsFile": file }) .then(response => { console.log('SUCCESS!', response.status, response.text); }).catch((error) => { if (error.response) { console.log('FAILED...', error); alert(error.response.data.items.message) } else { console.log('FAILED...', error); alert(error) } })// end AXIOS post

Código rápido de back-end (index.js)

 app.post('/sendmail', async (req, res) => { const {toEmail, bccEmail, studyType, patientName, attachmentsFile} = req.body; // >> attachmentsFile is empty!! not sure what I'm doing wrong const msg = { from: "xxxx@xx.com", // sender address to: `${toEmail}`, // list of receivers bcc: `${bccEmail}`, // bcc - hiden subject: "subject " + `${patientName}` + " - " + `${studyType}` attachments: `${attachmentsFile}`, // PDF Attachment html: "msg here ..." } // .... more code here working ok! } // end post

Cualquier ayuda sería realmente apreciada. ¡Gracias!

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!