When sending an email attachment, the file extension does not show and is displayed as "unknown"

When sending an email attachment, the file extension does not show and is displayed as “unknown”.




Hey @2020_qadan ,

Would you mind embedding this part of your Workflow .

I think you need to pass the attachment as a binary file

@mrrobot

I’m not very skilled at embedding workflows, so I’ve pasted the JSON code of the workflow below. Could you please explain how to pass the attachment as a binary file? I only filled in the “Put Output In Field” value in the QuickChart section.

If you need to name your files and the node doesn’t do that, you can add your own names:

Notice the lack of the name on the left and its presence on the right.

for (const item of $input.all()) {
  const ext = item.binary.data.fileExtension;
  item.binary.data.fileName = `mychart.${ext}`;
}

return $input.all();
1 Like

Hey @2020_qadan ,

Does your attachement contains the right file thought ?
If you download it and rename it to something.png does it open correctly ?

JM

@jabbson @mrrobot I still failed in the test. I added a “code” node after QuickChart, pasted the code you provided into it, and filled in “QuickChart’s Put Output In Field” in the “Attachments” section of the “send mail”. However, the attachment is not displayed in the email. Could you paste the workflow for me to review?

Could you embed your last attempt please?

Just ran this very same workflow with the only change - email address, this is the result:

and here is the expanded attachment

How should the “html” option be filled in when sending an email?

It’s the text you want to send in the email in the HTML format. The option allows you to switch to plain text or to have both plain text and html.

So it is basically the “message” portion of the email letter.

The screenshot of your test email shows the image directly, not as an attachment. I have two questions: 1. How can the image be sent as HTML content? 2. How can the image (whether in PDF or XLSX format) be sent as an attachment?

The two questions I raised just now, could you please paste the workflow code for me to refer to?

not true, it even says attachment on the screenshot:

As to how you can send an image as a part of the html:

<html>
  <body>
    <h2>Hello from n8n!</h2>
    <p>This is an embedded image:</p>
    <img src="cid:chartData" alt="Embedded Image" />
  </body>
</html>

chartData refers to the Content-ID of the attachment.

Alternatively, you can use regular img with remote source:

<html>
  <body>
    <h2>Hello from n8n!</h2>
    <p>This is a remote image:</p>
    <img src="https://community.n8n.io/user_avatar/community.n8n.io/2020_qadan/48/95301_2.png" alt="Image of 2020_qadan" />
  </body>
</html>

I was able to insert the image into the body of the email using the code you provided. However, I still have another issue that hasn’t been resolved. How can I use the Attachments feature in the email to add the file as an attachment to the email? Could you provide an example workflow file?

Which email client are you using?

office outlook 365

This post was flagged for moderator attention.