Scott Hanselman

Blat - Command Line Emailer saves me time

February 28, '07 Comments [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 whatever@yourdomain.com - - 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
whatever@yourdomain.com -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 me@noneofyourcheese.com -subject %1 -body %1 -debug

So now,

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

Enjoy.

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
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web
Wednesday, February 28, 2007 11:26:20 AM UTC
.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...)
Wednesday, February 28, 2007 12:40:18 PM UTC
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...

Wednesday, February 28, 2007 1:27:20 PM UTC
No SlickRun Magic Word - guess the bat works as well? Check this out for your Vista Slickrun replacement: http://brandonlive.com/2007/02/22/new-tool-i-made-for-vista-start/

Ryan Cromwell
Wednesday, February 28, 2007 1:41:14 PM UTC
Ditto on Andrew's comment!

Get the PowerShell Community Extensions (from CodePlex) and just type:

mail -to "me@mail.com" -subject "PowerShell" -body "PowerShell rules!"
Wednesday, February 28, 2007 2:08:21 PM UTC
i think your GTD link is bad.
Wednesday, February 28, 2007 2:30:57 PM UTC
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.
Wednesday, February 28, 2007 2:44:07 PM UTC
>i think your GTD link is bad.

yeah, it should be

http://www.davidco.com/

/johan
Wednesday, February 28, 2007 4:58:22 PM UTC
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.
Wednesday, February 28, 2007 6:08:19 PM UTC
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.
Wednesday, February 28, 2007 7:18:22 PM UTC
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.
Dave P.
Thursday, March 01, 2007 2:07:32 AM UTC
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 ;).
Thursday, March 01, 2007 2:11:37 AM UTC
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"
Thursday, March 01, 2007 3:36:44 AM UTC
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.
Rod Ball
Thursday, March 01, 2007 9:13:25 PM UTC
todo bookmark scott's blog to build a todo so I can email myself todo tasks
John A. Davis
Comments are closed.

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