BLAT for Windows
Easily mail any file from the command line
As of June 2003 Blat management has moved to SourceForge.net
Blat is a Public Domain Windows 95/NT console utility that sends the contents of a file in an e-mail message using the SMTP protocol. Blat is useful for creating scripts where mail has to be sent automatically (CGI, backups, etc.), or just as a quick way to send a file or message quickly from the command line. It will store relevant configuration details in the registry for ease of use. Optionally, blat can also attach multiple binary files to your message.
In early 1998, I wanted a way to mail binary files quickly and reliably. The closest thing I found was BLAT v1.5, which would mail ascii files from the command line. From that version, I added modifications to allow mailing of multiple ascii or binary files as well. Christophe Henquin has added some other useful options -- port specification, retry level, and multiple profiles. His Blat page is at http://pages.infinit.net/che/blat/blat.html
Also, check out Getmail for Windows, which is a command line tool to automatically download mail, including the ability to automatically extract binary attachments. It's the perfect companion to blat!
The original authors homepage for Blat is http://gepasi.dbs.aber.ac.uk/softw/Blat.html As of October 1998, I have officially assumed responsibility for the maintenance of Blat.
The most recent version compiled for intel is version 1.9.4. It was released on December 12, 2001. The most recent version compiled for Alpha is version 1.8.2b. Please let me know if you can compile and provide me with a newer binary for the Alpha platform!
Gilles Vollant has created an intel binary which is only 35kb in size. This is distributed in the above ZIP when possible. To see how he has done this, check out his MSVC++ 7.0 project file
Blat DLL
Toby Korn has created a DLL version of blat. It is available from his page at http://www.geocities.com/toby_korn/blat/.
Visual Basic & Blat
Joel Limardo has created a VB class that uses blat. His page is at http://www.blat.net/newdocs/MSAccess_class.html.
Mailing List: A Blat mailing list was created Sept 20, 1999. click here to browse the archives, or...
Revision history:
- 1.9.4 2001.12.12
- Speed up to processing of messages with mime/html/enriched attachments
- Add quotes around 'boundary' fields
- 1.9.3 2001.11.06
- Wildcards that included sub-directories caused blat to die
- 1.9.2 2001.8.21
- Added "-a1" and "-a2" settings to control initial two headers
- 1.9.1 2001.4.25
- Added "-charset" setting (NOT FULLY TESTED)
- 1.9.0 2001.4.5
- Added "-priority" setting (Toby Korn)
- 1.8.9 2001.3.19
- Minor changes. (My hard drive crashed, I lost details on what changed)
- 1.8.8 2001.3.9
- Fixed multi-line reponse support with some ESMTP servers (Tim Charron)
- 1.8.7 2001.2.28
- Added "-authplain" Plain Authorization (Craig Morrison < [email protected] >)
- The character '?' is now converted to quoted-printable (Fabien THIRIOT < [email protected] >)
- 1.8.6e 2001.2.1
- Fixed possible crash when sending multiple files (occurred if subsequent files were smaller than earlier ones)
- 1.8.6d
- Bug in GetLengthConvertToQuotedPrintable, possible crash situation (Michael Walz < [email protected] >)
- 1.8.6c
- Misc. changes (based on Lint output)
- 1.8.6a 2000.10.20
- Fixed a problem reading -bf/-cf/-tf files. Possible crash.
- 1.8.6 2000.10.27
- Fixed the fixup() fix. ugh. It should work now.
- 1.8.5j 2000.10.19
- Fixed the 'fixup' routine, which caused problems when recipient name had accented characters
- Fixed conversion of non-std characters in the subject line (no line breaks) (from Biebricher, Peter < [email protected] > )
- 1.8.5i
- Add the -log option. Change from Craig Morrison
- 1.8.5h 2000.08.23
- Optimize the "-" with console input (slow in 1.8.5g)
- 1.8.5g 2000.08.22 (Co-ordinated by Gilles Vollant < [email protected] > )
- -sf fix from Craig Morrison < [email protected] > . If the file does not exist the filename itself is copied
- when '-' is used for console input, a temp file is not created
- 1.8.5f 2000.07.05 (Co-ordinated by Gilles Vollant < [email protected] > )
- -s @subject.txt : Reads the first line of the file @subject.txt for the subject line of the message. Change from Craig Morrison
- -t johndoe < [email protected] > Now works correctly and just sends '[email protected]' . Change from Craig Morrison < [email protected] >
- 1.8.5e 2000.07.04 (Co-ordinated by Gilles Vollant < [email protected] > )
- Add -u and -pw option for AUTH LOGIN
- 1.8.5d 2000.07.02 (Co-ordinated by Gilles Vollant < [email protected] > )
- Supress temporary file for console input
- fix crash with -debug option
- 1.8.5c 2000.05.10 (Co-ordinated by Gilles Vollant < [email protected] > )
- Fixed POST for CGI feature
- 1.8.5b 2000.03.13
- 1.8.5 2000.02.08
- RFC compliant options added by Skough Axel IT-S < [email protected] >
- mailfrom < addr > The RFC 821 MAIL From: statement
- from < addr > The RFC 822 From: statement
- replyto < addr > The RFC 822 Reply-To: statement
- returnpath < addr > The RFC 822 Return-Path: statement
- sender < addr > The RFC 822 Sender: statement
- Migrated -t to -to, -c to -cc, -b to -bcc, -s to -subject, -o to -organization
- 1.8.4e 2000.01.14
- - -body translates '|' into CRLF
- 1.8.4d 99.11.22
- - Added "-body" parameter (requires argv[1]=="-")
- - Fixed problem with missing To/CC headers
- 1.8.4b 99.09.22
- - buffer from 255 to 2048 chars (I forget which one)
- - -x fixed
- - -noh2 fixed (-noh or -noh2 was messing up headers)
- - single quotes in email addresses used to mean 'comment'. Removed.
- - Replaced "|" in if statement with "||" inside of ConvertToQuotedPrintable(). 99.9.20
- - Added -enriched and -html options (Courtesy of James Greene)
- - Enhanced support for paths in -attach files (Bergamini Angelo < [email protected] > )
- - Added df/cf/bf command line options to support using email addresses from a file (Kenneth Massey < [email protected] > )
- - Added header when mail is sent using cgi.
- 1.8.4 (99.02.20)
- Much improved support for use within CGI scripts (by Gilles Vollant) (see included blatcgi.txt file)
- Minor change to "Date:" header generation code. Although it was Y2K compliant, it wasn't obvious. This was fixed to remove the confusion.
- Added support for customized "X-" style headers. (-x)
- 1.8.3 (99.02.??) Internal development release.
- 1.8.2d (99.01.??) Added -debug flag.
- 1.8.2c (98.12.??)
- Added optional "Return-Receipt-To:" and "Disposition-Notification-To:" headers.
- It's now possible to run blat without an install. You must specify the "-server" and "-f" parameters (at a minimum) on the command line.
- 1.8.2b (98.11.30)
- Removed all calls in gensock to MessageBox()
- Fixed timeout when configured for retries. (was using ms instead of s)
- 1.8.2a (98.11.20) "-q" option was still printing "Attached text file: attach.txt" messages
- 1.8.2 (98.11.17)
- 1.8.1 was identifying itself as 1.8.0
- Added termination boundary to messages with attachments
- Autodetection of file types in MIME headers
- 1.8.1 (98.11.17)
- Fixed Multiline response treatment. (courtesy of Wolfgang Schwart < [email protected] >)
- Fixed ability to use "-" filenames. Ctrl-Z detection was broken.
- Fixed use of "-noh"/"-noh2" option (also broken in 1.8).
- 1.8.0 (98.11.2) 1.8 is a merge of 2 different source trees which started diverging at version 1.5.
- If you're upgrading from the prior "official" release, then changes include:
- Use of "-attach *.ZIP" to send multiple files
- Use of 'profiles' to store server/userid/password/port in the registry for multiple profiles.
- Multiple retries
- Other changes as described below labeled version 1.6-1.7.9
- If you're upgrading from the 1.7.9 originally released on this page, then changes include:
- gwinsock.dll/gensock.dll are no longer needed
- UUencoding of the main file is possible
- Graceful termination of connection to smtp server
- hostname <hst> option to select the hostname used to send the message
- Ability to specify port using "server:port" style names.
- 1.7.9 (98.9.16) Bugfix. Some mail readers were ignoring the final mail attachment. A final boundary line was added to correct this.
- 1.7.8d (98.9.1) Added "-noh" and "-noh2" options to change/remove X-Mailer header
- 1.7.8c (98.8.25) Changed copyright limitations to prohibit use as a spam tool
- 1.7.8b (98.8.11) Cleaned up some wild pointers that was a potential crash. (although crashes have not been reported, better safe than sorry...)
- 1.7.8 (98.8.8) Support for non-standard character sets in the header fields (hopefully).
- 1.7.7 (98.8.8) Fixed problem with wildcards/filename parsing when compile with Watcom
- 1.7.6
- Made output cleaner when wildcards used
- Increased limit on attachments to 64 files
- Message Boundary is a random string instead of a fixed string (allows sending 2 or more blat messages as attachements to a 3rd message using BLAT)
- 1.7.5
- Fixed reading from file "-", there was a phantom character appearing
- Added the ability to use wildcards for "-attach" and "-attacht" option
- Added a delay of 15 seconds between retries
- 1.7.4 Minor correction to return values in the event of server timeout
- 1.7.3 (98.4.22) Fixed "-attach"ing of largish files (but in calculation of internal space required).
- 1.7.2 (98.4.16) Added "-attacht" which enables attaching multiple files without base64 encoding them.
- 1.7.1 (98.3.27) Minor command line parsing bugs fixed
- 1.7 (98.3.20)
- Added command line option "-port" to override the default SMTP port
- Added command line option "-try" to specified how many times blat should try sending
- Added "profile" to quickly choose server, sender, n of tries and port
- Added "-profile" to edit profiles
- 1.6.3 (98.2.25)
- Added command line option "-attach" to allow attaching multiple binary files to a message
- "-base64" causes inclusion via 'attachment' method instead of 'inline'
- 1.6.2 (98.1.11)Added command line option "-o" to provide Organization field in the headers of the sent message.
- 1.6 (97.10.20)
- Added support for mailing of binary files (mime base64 encoding)
- Fixed argument parsing for '-q' and '-mime' options (these used to only work if they were the last argument)
- 1.5
- Two bugs were corrected that made Blat generate exceptions with certain CC or BCC adresses.
- Blat now generates descriptive error messages, rather than the infamous "gensock error 4017" type errors
- Blat now returns an error code when the SMTP session fails
- A new option -mime was added. This implements the possibility to use the MIME quoted-printable transfer encoding.