1
Nodemailer를 사용하여 전자 메일에 파일을 첨부하고 싶습니다. 나는이 안내서를 따라 여러 가지 방법을 시도했다 : https://nodemailer.com/using-attachments/, .pdf, .txt .... 아이디어가 있으십니까? 이 마지막 시도 내 코드입니다 :Node.js 및 express : nodemailer에 첨부 파일
router.post('/profilocliente/:id', function(req, res, next) {
Customer.findById(req.params.id, function(err, customer){
if(err) throw err;
var mailOptions={
to : customer.email,
subject : req.body.oggetto,
text : req.body.testo,
attachments: [{path: 'C:/Users/Angelo/Desktop/test.txt'}]
}
console.log(mailOptions);
smptTransport.sendMail(mailOptions, function(error, response){
if(error){
console.log(error);
res.end("error");
}else{
console.log("Message sent: " + response.message);
res.redirect('/clienti/profilocliente/'+customer._id);
}
})
})
});