Scott Hanselman

Blat - Command Line Emailer saves me time

February 28, 2007 Comment on this post [14] Posted in Tools
Sponsored By

I was reading my boss's blog today, as he's a hard core GTD practitioner - more than I - and I'm trying to get better at it.

He recently went on an automation rampage kick around his home IT and wrote a pile of scripts. He also tends to email him self quick little reminders that are filed as todos, as do I, except he can just type

todo "Write a blog post on foo"

And it'll be mailed to him with an appropriate subject and tagged in his Gmail account.

He's using BLAT under Windows (using sendEmail under Linux). BLAT is a command-line util for sending email under Windows. It'll also post to USENET via NNTP if you like.

You can include all the settings on the command-line, or just "install" them in the registry, once, like this:

blat -install localhost - - FromScott

Where "FromScott" is the name of a profile we'll use later. Then I can create a TODO.BAT (or TODO.PS1) and put this in it:

@echo off
blat -p FromScott -to -subject %1 -body %1 > NUL

I like running BLAT with -debug, because I'm all about -verbose, don't you know.

NOTE: I'm using Vista and when I ran blat for the first time I was warned by the loader I didn't have MSVCR71.dll, so I ended up getting it and putting it in the same folder as BLAT then it was cool.

I ended up making todo.bat, worktodo.bat and hometodo.bat and they look like this:

start "TODO-ING" /MIN c:\pathto\blat.exe -p FromScott -to -subject %1 -body %1 -debug

So now,

c:>todo "Write a blog post about how my Home IT is automated"


About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
February 28, 2007 11:26
.bat files? I thought you were a PowerShell guy. (Talking of which, Bruce Payette's book has now reached us here in the UK. I got mine...)
February 28, 2007 12:40
Cool How-To, but what the heck do you do with all those emails you send to yourself? I do something similar (thought not nearly as automated) and am mired in the minutia...
February 28, 2007 13:27
No SlickRun Magic Word - guess the bat works as well? Check this out for your Vista Slickrun replacement:
February 28, 2007 13:41
Ditto on Andrew's comment! Get the PowerShell Community Extensions (from CodePlex) and just type: mail -to "" -subject "PowerShell" -body "PowerShell rules!"
February 28, 2007 14:08
i think your GTD link is bad.
February 28, 2007 14:30
Instead of emailing to Gmail, you could also set it up to email to a Remeberthemilk address to auto add it to your task list. I personally hate using my email as a personal todo list.
February 28, 2007 14:44
>i think your GTD link is bad. yeah, it should be /johan
February 28, 2007 16:58
Why not .ps1 files? I used a batch file so I can use it from Start|Run or slickrun or ANYWHERE. I don't have to have a powershell window open, and it still works anywhere. I use the emails to trigger rules in Outlook that create tasks, then they are deleted.
February 28, 2007 18:08
That's true... I'm ready for the day when PowerShell will be as widespread as bat so that we CAN use ps1 files in the same way as bat files.
February 28, 2007 19:18
FYI, you don't have to have powershell open. You can use a powershell script by passing it as a value to powershell.exe. But it's ugly b/c it actually opens a command window to do it. Batch files don't have this issue. Now if you can figure out a way to run powershell scripts in a hidden window, then you'd be onto something.
March 01, 2007 2:07
Scott... You better delete this blog quickly. You have just announced to you wife a very simple way of piling on the HoneyDo list anytime an idea pops in her mind. BTW. I have just created an email rule to send all my tasks to Scott's email. Clearly if you can get three blogs out in a single day, you have time to clean up my task likst ;).
March 01, 2007 2:11
As a follow up... I can Scott's tasklist now: TODO "Buy Cialis today", TODO "Order more Vi@gr@", TODO "Make thousands in my spare time"
March 01, 2007 3:36
Did you find or write a custom action that creates the outlook task automatically? The best I was able to do with the default rules in 2007 was to automatically assign it to a category like @Work, set the no date flag so it shows up in my "To-Do" list, and then move the e-mail to another "Tasks" e-mail folder to hold it until I was finished with it. Then when I am done, I just delete the e-mail item listed in my "To-Do" list. Not the best solution, would rather have a real task so I don't have to keep the e-mail around, but it works.
March 01, 2007 21:13
todo bookmark scott's blog to build a todo so I can email myself todo tasks

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.