我有一个在线表格,申请者可以使用我安装的html2pdf插件下载pdf格式的表格。我也有nodemailer设置,申请者可以发送电子邮件。但我不知道如何附加这两个功能。我更希望剥离nodemailer表单只是一个提交按钮,这将只发送pdf到我选择的电子邮件使用nodemailer。
发布于 2018-09-02 13:16:43
试试下面的代码,它为我工作。此link可帮助您输出html2pdf
$html2pdf->output('/absolute/path/file_xxxx.pdf', 'F');
transporter.sendMail({
from: 'foo@bar.com'.
to: 'bar@foo.com',
subject: 'An Attached File',
text: 'Check out this attached pdf file',
attachments: [{
filename: 'file.pdf',
path: '/absolute/path/file_xxxx.pdf',
contentType: 'application/pdf'
}], function (err, info) {
if(err){
console.error(err);
res.send(err);
}
else{
console.log(info);
res.send(info);
}
});https://stackoverflow.com/questions/52134160
复制相似问题