Sometimes when you come up with a new project to work on you jump right in without fully considering all the possible side projects you will need to work on to get the main project working.
For example:-
Step one of my Server Side Mail Filters SSMF was to create a SPAM folder. All my domains have a catchall email address where all those emails sent to address not existing end up. this is mainly for people who spell my name wrong, or use weird formats that they are used to.. firstname.surname@ initial.surname@ etc… Or for those rare occasions when I use a new email address for a project/webpage and forget to actually create the email box :0( (Rare but does happen)
So my plan is to have a SPAM folder on my main map box, and all unknown mails automatically be dumped in there for me to check at some later point. Now while setting up this default basic rule in exim I had the brilliant idea to not just place them in all together in a SPAM folder but to further split them into .SPAM.DOMAIN_NAME this way i can see which domains are getting hit hardest, and easily hunt out mislaid emails.
“What a brilliant simple idea!”
Well yes! and at the same time No! You see, delivering the emails into separate folders is easy, and took no time at all to set up. Now the smarter amongst you will have already spotted my problem with this. “Did you spot it?, No? Never mind. Let me explain” Every time an email comes in for a new domain name, it will create a new subfolder in the SPAM folder and deliver the email there, This is good apart from the fact with IMAP email clients you only see the folder you are subscribed to, which means I will not see the new folder or any emails it contains unless :-
1) I pre create all possible subfolders ready
2) I check every so often for new folders and then subscribe to any new ones.
I considered these two time consuming options and after deep consideration I stood up and declared “I AM GEEK! I do not use the options available to mere users, I make my own options, I choose option 3!”
So, Time for a quick Side project to create option 3. A self subscribing mail script. A simple find command piped through cut, sed creates a list of folders which is then outputted to overwrite the courierimapsubscribed file, get this script to run every so often in the cron and as soon as a new folder is created, your subscribed to it.
Now back to the main project.