I’m trying to understand how to download attachments from my email account and save them in a folder, but renamed with the subject
I can’t figured out how save in a file with the original extensions, 'cause i do not know what kind of attachment will be in the next email.
I’m currently doing something like this:
This means if I wanted to use the subject name as the filename when saving it and the extension I can use an expression like this /files/{{$json["subject"]}}.{{$binary.attachment_0.fileExtension}} of course using the subject could lead to trying to use characters the OS can’t use in a filename so that would need to be thought about but a simple workflow that would do the job is below.
Multiple attachments is a bit trickier, If you look at the example workflow linked below there is a part for transformation. This will turn multiple attachments into multiple items, If you add that between the email node and the write binary data node it should do what you are after.
I made a workflow that saves email attachments, rename with email subject limited to 20 chars, consequentially numbered and managed file extensions.
Hope this help someone