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

314
Views
Send email with attachments after a file is generated

I’m running an approval flow that generates an index.html table file with all items requested.

There is a button to approve all requests and a button to generate a .csv file.

I need to send an email to whoever approves the request (after clicking the “approve all” button) with the .csv file as an attachment. Is there any way I can do this?

Thanks in advance.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Nodemailer supports different ways of setting attachments.

var nodemailer = require('nodemailer');
        

 var transporter = nodemailer.createTransport({
      host: 'host.com',
      port: 465,
      secure: true,
      service: 'gmail',
      auth: {
           user: 'user@gmail.com',
           pass: 'gmailpassword'
      }
});
    
var mailOptions = {
     from: 'sender@gmail.com',
     to: 'receiver@gmail.com',
     subject: 'CSV File',
     text: 'Hello world',
     html: '<b>Hello world</b>',
     attachments: [{
         filename: 'csv-file.csv', // file name
         path: '/path/to/csv-file.csv' // file path
     }]
 };

// send mail
transporter.sendMail(mailOptions, function(error, info){
    if(error){
        console.log(error);
    }
    console.log(info.response);
});

you can use convert data into CSV before sending it. Use module like papaparse.
NodeMailer -> Nodemailer Repository GitHub

about 4 years ago · Juan Pablo Isaza Report
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!