title: how to send an Excel file to an email using nodemailer module
body: <p>I am using 'nodemailer' module to send an Excel file as an attachment to an email.  </p>
  
  <p>Note: What i am passing to 'content' in attachments is an array of objects.</p>
  
  <pre><code> function sendEmailWithAttachments(recipientEmailId, subject, content, next) {
  
          var ormMailerInfo = getORMMailerInfo();
          var transporter = nodemailer.createTransport(smtpTransport({
              host: ormMailerInfo.orm_mailer_host,
              secure: ormMailerInfo.orm_mailer_secure,
              port: ormMailerInfo.orm_mailer_port,
              auth: {
                  user: ormMailerInfo.orm_mailer_user,
                  pass: ormMailerInfo.orm_mailer_pass
              }
          }));
  
          transporter.sendMail({
              from: ormMailerInfo.orm_mailer_user,
              to: recipientEmailId,
              subject: subject,
              attachments: [
                  {   /* the uniqueness of my question begins from here */
                      // file being sent is Excel file as '.xlsx' indicates
                      filename: subject + '.xlsx',
                      // content/data being sent an array of objects
                      content: new Buffer(content,'utf-8')
                  }
                  ]
          }, next);
      }
  </code></pre>
  
  <p>I have successfully sent and received it but when opening the excel file, it displays this error below:</p>
  
  <p>"Excel cannot open the file 'filename.xlsx' because the file format for the file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file."</p>
  
  <p>Any help, dear members ?</p>