Yes you can. You have to add the path of the file which you are trying to attach.
transporter.sendMail({
from: '[email protected]',
to: '[email protected]',
subject: 'An Attached File',
text: 'Check out this attached pdf file',
attachments: [{
filename: 'file.pdf',
path: 'C:/Users/Username/Desktop/somefile.pdf',
contentType: 'application/pdf'
}],
function(err, info) {
if (err) {
console.error(err);
} else {
console.log(info);
}
}
});