I have a IMAP Trigger which checks for new Emails. The Emails have attachments. Some Emails have multiple Attachments, some Emails only have one attachment. Depending on the Recipient in the email the attachments are supposed to be uploaded to a specific path with the Nextcloud API. For this I have an javascript function node.
Everything works but if I have multiple Emails, it only works for one Email. All Emails are marked as read but it only downloads the attachments for one email.
Please share the workflow
Information on your n8n setup
n8n version:
0.136.0
Database you’re using (default: SQLite):
SQLite
Running n8n via [Docker, npm, n8n.cloud, desktop app]:
Docker
I think you could approach this in a similar fashion to what I have described here:
Essentially convert a single n8n item (your incoming email) with multiple binary files into multiple n8n items each with a single binary file inside the data property.
Your Nextcloud node would then run once for each item it receives and can process a single file with each run. Let me know if you run into any trouble with this
thanks a lot for your answer. I use this solution already. The problem is, I have three emails with attachments. It works for one email but it ignores the other Emails?!
Hello, I found the solution witch for loops. If you use loops, you cant use return, cause it finishes the loop. You have to use an array and push it into it.
Thanks a lot!
Hi @aiko, I am so sorry for missing the multiple email part from your question, not sure what I was thinking yesterday. I am glad to you found a solution though, thanks so much for confirming.
Based on your description the loop seems to be the most sensible approach here. Hope you enjoy your automation journey