The size of e-mail attachments is not displayed to the recipient

Describe the problem/error/question

The created workflow embeds a XML file into a PDF file and sends it back to the sender.

In the email client of the sender (tested with Thunderbird, which shows the size of attachments very well) the size of attachments send via n8n will not be displayed (Size unknown).

As far as I know, n8n uses nodemailer to send emails via the send mail node. The attachments object of nodemailer does not have a property “fileSize”, so I tried to use the property “header” instead, like this:

pdfFile.headers = { 
    'Content-Length': pdfFile.fileSize,
    'Content-Transfer-Encoding': 'base64',
    'X-Unsent': '1'
}

If I check the json output, the header is set correctly.

Unfortunately, this didn’t change anything. I searched extensively for this problem, but either I used the wrong search terms or no one seems to be addressing it.

Does it not work at all with nodemailer or do I miss something?

Workflow

Output returned by the last node

Information on your n8n setup

  • n8n version: 1.83.2
  • n8n EXECUTIONS_PROCESS setting (default: own, main): not set
  • Running n8n via (Docker, npm, n8n cloud, desktop app): npm in Docker (FROM n8nio/n8n:1.83.2)
  • Operating system: Host: Manjaro, Docker: Alpine

This should provide some details to potentially work from:

It seems to be recommended to use something like, instead of header, but n8n may just be limited on feature set:

pdfFile.raw = 'Content-Type: application/pdf\r\n' +
               'Content-Disposition: attachment; filename="' + pdfFile.filename + '"\r\n' +
               'Content-Transfer-Encoding: base64\r\n' +
               'Content-Length: ' + pdfFile.fileSize + '\r\n' +
               '\r\n' +
               // Base64 encoded content would go here```

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.