Home | Tip of the Week | Tip of the Week Archive | Partners | Clients | History | Friends

Tip of the Week (Archived)
Email Enable Your Windows Applications with Blat

First, let me say that Blat has nothing to do with Oracle. But it has been a great addition to my toolkit over the years, whenever I have needed to have a Windows server application provide some type of user notification based on an event. It is a Windows command line utility for sending email and is public domain software (free!), available at www.blat.net.

Why would someone be interested in Blat? Sometimes an application just needs to be able to notify one or more users about specific situations that occur, where the best type of notification is email. But many Windows servers do not have an email client, such as Outlook, installed and configured. And even if an email client is installed, using it to send an email from an application may not be the most straight forward task to perform.

And this is where Blat comes in. No installation is necessary. No email client is necessary. Simply copy the file blat.exe to any directory in your command line path, such as \WINDOWS\system32, and you are ready to send email using a command like this:

blat - -body " " -s "Subject line text" -server mail.myserver.com -to recipient@anotherserver.com -f sender@myserver.com

The output from the above command is:

Blat v2.5.0 w/GSS encryption (build : Sep 14 2005 22:46:29)

Sending stdin.txt to recipient@anotherserver.com
Subject: Subject line text
Login name is sender@myserver.com

The result is that an email with no message body is sent to recipient@anotherserver.com with the subject line Subject line text. The arguments are:

- The first argument is a file name that contains the message body. If the first argument is a dash, then blat expects the message body to be supplied through the command line.
-body Text to be used for the message body. For application purposes, a message body may not be necessary, just a subject line. blat still requires a value, which in this case is a space.
-s Subject line. If not provided, the file name that appears in the subject line "Contents of file: file name". If the message body is provided on the command line, the file name will be stdin.txt.
-server The SMTP mail server through which the email is to be sent.
-to The email address of the recipient
-f The email address of the sender. The sender's address must be recognized by the mail server.

Many other options are available, with documentation available through the Blat web site or by typing blat -h at the command line.

Note: This tip was tested on Windows XP and Windows Server 2003.

Was this tip useful? Did you find any errors? Do you have any suggestions? Do you care? Click here for the tip feedback page. Thank you.

2000 Turnberry Circle, Glenmoore, PA 19343
Voice: (610) 942-1979
Fax: (610) 942-1990
Email


© 2006 Alydan Consulting, Inc.