It happens to me very often that I’m at work to discover that I can’t read my e-mail because I forgot to close Outlook at my desktop PC at home before leaving for work. Since it polls every 5 minutes, the changes that I catch an email, are close to zero.
Because I’m playing with Unix a lot lately (I upgraded my server from Windows XP to Ubuntu Edgy Eft) I thought: what if I could send an email that could be scanned by the content-filter (like amavis in combination with antivirus/spam software does) and when it’s the correct message shutdown Outlook. The idea is simple, right?
Scanning a message for the right flags to be up (the right sender, the right subject, the right content, whatever) is not that hard, since Outlook has “rules”. Just create a rule that fires just after the message arrived and scan for whatever your think is secret enough so nobody else will guess it. Or make it come from an account that only you have access to. No big deal.
But how do you shutdown Outlook? I tried creating a macro with “Application.quit” in it, but I can’t seem to select that in a rule. But I saw that you could “start an application” from a rule. Now what’s the equivalent of “kill” under Windows XP? The resource kit (that I don’t have) does have the kill command. But what is standard? So I googled around, and found the command “taskkill”.
So…create a batch file somewhere, and call it somethink like “ShutdownOutlook.bat” and copy the following text in it:
@echo off
taskkill /im outlook.exe
The “/im” parameter tells taskkill to look for an “image” that is called outlook.exe. And then taskkill it, which basically means: shut it down gracefully.
Now go back to your newly created rule in Outlook, and tell it to “start an application” and point to ShutdownOutlook.bat.
Voila!
Modifying the batch file to close Thunderbird, Eudora (which will be Open-Sourced later this year), or some other more exotic e-mail client should be not too difficult, as long as it supports rules or macros that allow an external command to be executed.