我想从附加了从 excel4node 库编写的 .xlsx 的 nodemailer 发送邮件。我不知道该怎么做,但我可以单独做这两件事。
我尝试将文件写入并存储为临时文件,然后再次打开文件,但 firebase 弹出错误Error: EROFS: read-only file system, open
我真的不知道该怎么做,请帮忙。预先感谢。
我想从附加了从 excel4node 库编写的 .xlsx 的 nodemailer 发送邮件。我不知道该怎么做,但我可以单独做这两件事。
我尝试将文件写入并存储为临时文件,然后再次打开文件,但 firebase 弹出错误Error: EROFS: read-only file system, open
我真的不知道该怎么做,请帮忙。预先感谢。
我知道了!!!。使用来自 excel4node 的写入缓冲区,然后将它们发送到附件的内容
const xl = require('excel4node');
async sendMail(data) {
var wb = new xl.Workbook();
var ws = wb.addWorksheet('SHEET_NAME');
ws.cell(1, 1).string('ALL YOUR EXCEL SHEET FILE CONTENT');
let buffer_xlsx = await wb.writeToBuffer();
// in the option header of nodeMailer
header: {
from: 'abc@example.com',
to: 'xyz@example.com',
subject: 'Excel File',
attachments = [
{
filename: 'report_' + filename + '.xlsx',
content: buffer_xlsx,
}]
}