I'm trying to send email with excel attachment through @nestjs/mailer:
await this.mailService.send({ //service with @nestjs/mailer
to: messageTo,
subject: messageTitle,
template: 'application-approved',
context: {
content: messageBody,
},
attachments: attachments.map(({ name, arrayBuffer }) => ({ // array with filenames and arrayBuffers
filename: name, // filename like `name.xlsx`
contents: arrayBuffer, // arrayBuffer contains filled excel file
contentType: // tried to remove this property - no effect
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
})),
});
When a message arrives, all attachments are marked as broken. I tried to send both ArrayBuffer and Buffer - It had no effect.
In other hand HTTP route that creates the file and attach it to response succeeds.
Any ideas to solve this problem?