Open hugobyrne opened 7 months ago
Where does yyyy come from? Current time? Or date of the email?
Please first have a look at related issues:
By design, all filter actions only have a single parameter (Detach and save attachment use an existing folder name)
I suggest we solve #219 first because it will add more flexibility, rather than hardcoding one method that only allows the year.
Also note that filters run synchronously (so the filter action cannot wait for asynchronous functions to finish) - which may lead to big problems (up to locking and crashing Thunderbird) when new folders need to be generated, as such file operations are by nature asynchronous. That means:
if the filter matches with 10 emails that need the new folder c:\account\2024\attachments
the filter would need to create the folders 2024 and then attachments for the first email and then store the attachment. Since create folder is async, we need to fire off a function async saveInNewFolder(path,attachment)
that does this and awaits the folder to be there and then save the attachment. In the meantime (since filter actions are sync, so they cannot technically wait for an async function to finish) the filter picks up the next email and tries the same - if the folder is not yet created by the first instance of saveInNewFolder()
the second instance may also try to create the folder, the first instance may fail.
On top of that filters are expected to run in a certain order (top to bottom) and incorporating of async functions can effectively break that. Just something to be aware of.
Just updated my first comment (got some of the linked bugs wrong) I suggest you read it online and not from your email.
Also of interest: There are number of issues (mostly feature requests, but quite a few bugs) that reference attachments - just to show that work in this area is tricky. Please have a look when you get time - I used a tag to mark all of them:
https://github.com/RealRaven2000/FiltaQuilla/labels/attachments
I was thinking the current date but you could probably use the email date too. And yes it does sound a bit more complicated than I originally thought. My original purpose for this was to autosort accounting-related attachments (invoices etc) into different folders by year but now that I think of it, its actually the financial year I need for this. I can probaby dump the attachments into a shared folder and then write my own program/script to relocate into other folders from there. I will have a look at those other related issues you listed, thankyou.
Just looking at the related issues you mentioned for my case anyway, all I would really need is the from email address included with the saved attachment somehow (prefix in the filename maybe like Attachment Extractor). If I wrote my own script, some attachments might simply be called "invoice.pdf" and it will need the from address to identify what the invoice is related too.
One final point to consider, I'm thinking it's actually quite important to include the from address in the filename when auto-saving attachments. This is because you may receive malware in a file attachment and ideally you want to know where the attachment came from before you click on it. (Otherwise set up the mail filter so that attachments are only auto-saved for specific known email addresses).
One final point to consider, I'm thinking it's actually quite important to include the from address in the filename when auto-saving attachments. This is because you may receive malware in a file attachment and ideally you want to know where the attachment came from before you click on it. (Otherwise set up the mail filter so that attachments are only auto-saved for specific known email addresses).
Yes I think attachment names should have some various options. Email addresses can be spoofed (and they usually are with Spam) so it's not really adding much security, it could actually lead to the opposite. For instance, I am getting a lot of spam which uses a friend's name in the subject line.
I take your point however in my use case I am expecting attachments from a very specific list of email addresses so I would regard something from a gmail address with suspicion.
Would be super useful if we could embed a dynamic date string into the folder path for saving attachments. (And if the folder doesnt exist then it is automatically created by FiltaQuilla).
So something like this:-
c:\account\{yyyy}\attachments\
Thanks for the great work! FiltaQuilla is a really useful addon.