【发布时间】:2018-09-02 13:16:42
【问题描述】:
我有一个在线表格,申请人可以使用我安装的 html2pdf 插件下载 pdf 格式的表格。我也有 nodemailer 设置,申请人可以在其中发送电子邮件。但我不知道如何附加这两个功能。我最好将 nodemailer 表单剥离为一个提交按钮,该按钮将使用 nodemailer 将 pdf 发送到我选择的电子邮件。
【问题讨论】:
标签: javascript html node.js nodemailer
我有一个在线表格,申请人可以使用我安装的 html2pdf 插件下载 pdf 格式的表格。我也有 nodemailer 设置,申请人可以在其中发送电子邮件。但我不知道如何附加这两个功能。我最好将 nodemailer 表单剥离为一个提交按钮,该按钮将使用 nodemailer 将 pdf 发送到我选择的电子邮件。
【问题讨论】:
标签: javascript html node.js nodemailer
试试下面的代码它对我的工作。这个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);
}
});
【讨论】:
$html2pdf->output('/absolute/path/file_xxxx.pdf', 'F'); 它说的是意外令牌>