I was looking for a way to create quick reminders for myself. After trying a few different programs, I looked to the command line to see what I could come up with. It turns out that “command-line email” is perfect for my needs. By combining Blat, Stunnel and Gmail, you can create a great reminder system for taking quick notes.
I’ve been a long time fan of blat, a command line utility that uses SMTP for sending quick messages. The problem is that a SMTP Server isn’t always available to every computer. For awhile, I was loading a separate SMTP Server program on any computer that I needed to use blat on. I have since found a far easier method. Enter Gmail. The geniuses at Google have done it again, allowing the smtp protocol to be used by your Gmail account.
The first step is to download blat and extract the 3 files to your C:\WINDOWS folder. Next.. download Stunnel to your computer. I was attempting to setup Gmail’s SMTP for quite a while before realizing that SSL is required and that’s why I couldn’t connect. This is a good thing though.. as we are now assured the messages we send to Gmail from blat are completely secure. Stunnel provides the tunnel. After downloading and installing, you’ll need to edit your stunnel.conf file with the following settings (yes, just overwrite everything in the file with this):
# GLOBAL OPTIONS
client = yes
output = stunnel-log.txt
debug = 0
taskbar = no
# SERVICE-LEVEL OPTIONS
accept = 127.0.0.1:1099
connect = smtp.gmail.com:465
accept = 127.0.0.1:1109
connect = pop.gmail.com:995
Now, start the service and then ‘Run Stunnel’ (both options from Program Files). Your secure tunnel is established. (We’re not actually using POP3 settings since we’re just interested in creating outgoing (SMTP) mail, but if you setup an email client (Oulook, Thunderbird, etc..), you could enable POP3 in your gmail settings and take advantage of this also. )
Finally, run the blat command line options to install SMTP to your computer and run the batch file we create for our command line reminders. Pull up a command prompt and this to install: blat -install smtp.gmail.com firstname.lastname@example.org -u gmailusername -pw gmailpassword – – gmailsmtp
This creates a registry entry with your smtp profile including a gmail encrypted username and password. Next up.. create the batch file that we’ll call when we type in the command line. It’s just as simple as this: c:\windows\blat.exe -p gmailsmtp -to email@example.com -subject Note: -body %1 -server 127.0.0.1:1099
Name your file note.bat and drop it in C:\WINDOWS as well. Now, pull up a command prompt and type: note “here’s some text to send”
Check your email.. and there’s your new note.
Keep in mind that you can send your email to anyone, as you’re just using the SMTP protocol from a designated gmail account. You also have a huge amount of other options that you could include your batch file so check out the blat syntax. You’re only limited by what blat can’t do and blat can do a lot!