How to send multiple xml files by email

I am not able to send multiple files in attachments through the “send mail” node

I can send the email, but the attachments won’t.

My idea is: fetch all xml files from the directory and send them by email.

I used the node “read folder files” it sends to the node “send mail” but it cannot send the files.

Do you have any idea how I can make the process run?

i’m using fetch n8n desktop version, i want all xml files from a local folder.

Hi @Presley_Nunes_de_Men, welcome to the community :tada:

I am sorry to hear you’re having trouble. Would you be able to share your workflow and confirm with which step exactly you’re currently having trouble?





in the last image i get multiple emails and no attachments, how do i get only one email and the attachments?

in this example there are 23 xml files

Thank you for your help

in the last image i get multiple emails and no attachments, how do i get only one email and the attachments?

So, there’s two different problems here. One would be your Attachments field. This seems to use an expression resolving to xml. However, your binary items are named data here:

Once you remove the expression from the Attachments field of your Send Email node and simply enter data here you should get emails including your attachments.

Perhaps you can give this a go in the first step?

This will still result in multiple emails (albeit with an attachment) and this is because most n8n nodes will run once for each input item. So, if you pass on 23 items to the Send Email node you’ll send out 23 emails. Meaning you would have to first merge your items into a single item before running your email node to avoid this behaviour. Here’s an example workflow doing this:

You can ignore the port on the post-it, that just generates some dummy data.

Hope this helps!

sorry for the delay in responding. I did as instructed and it worked perfectly sending an email for each attachment, I was happy with that. to merge the items into just one, I would have to compress them in zip or rar and this is not interesting for me. what I ended up doing was a python code that sent an email with all the xml attached. If you want I can send you the code. maybe it will inspire you to create another smtp node.

Thank you for your help.

Hi @Presley_Nunes_de_Men, glad to hear the first part helped. If you simply want to zip all files using n8n you might want to check out the example I’ve provided. Instead of sending out one email with multiple attachments you could easily make send a zip file instead like so:

image

yes, I tested sending compressed as zip, but my system cannot read compressed files in email, hence the need to send the files uncompressed.

Until next time, big hugs.

1 Like