Stuart's Python Page

Python is a simple scripting language (an experienced programmer really can learn the core language in a couple of hours) but it provides both object oriented and functional programming features as well as being a useful tool for general purpose real-world programming projects. See for more information about Python.

Automated Email File Despatch and Delivery

Here are three UNIX style command-line utilities (which run under both Linux and Window NT/4) designed to automate the dispatch and delivery of files via email:

mailextract - Extract MIME encoded attached files from mail message

mailfiles - Create and send mail message containing MIME encoded files

zcrypt - File encryption compression / decryption decompression

I wrote these utilities because I needed to automate sending multiple files via Email, my requirements were:

Use zcrypt to encrypt and compress files which can be sent using mailfiles. Use mailextract to extract the file from the mail message which is then decrypted and decompressed using the zcrypt -d option.

Under UNIX mail file extraction can be automated using procmail(1). Here's a hypothetical example /etc/procmailrc recipe that extracts, decrypts and decompresses files to /tmp/extract_file in messages to test.user with subject line test_extract:

# Test for,
# Lock (:test_extract) and wait till extract completed reporting
errors (w).
*^Subject: test_extract
| /usr/local/sbin/ - \
| /usr/local/sbin/ -d 3rgh8s - /tmp/extract_file

You can execute the following command pipe to test the procmail recipe:

/usr/local/sbin/ 3rgh8s test_file \
| /usr/local/sbin/ -s test_extract sender test.user


Copyright (C) 2002 Stuart Rackham. Free use of Connect is granted under the terms of the GNU General Public License (GPL).