[comp.sources.misc] v17i044: cmail - Setting Up A Compressed Mail Feed, Part01/01

mb@sparrms.ists.ca (Mike Bell) (03/17/91)

Submitted-by: Mike Bell <mb@sparrms.ists.ca>
Posting-number: Volume 17, Issue 44
Archive-name: cmail/part01

If sending mail over a modem or link is a major bottleneck, the following
set of files may be of use. They describe how to set up a mail link
which compresses the mail before transmission. 

We currently have this working on a feed to an ancient 1200 baud
modem which doesn't have any data compression. It may also prove 
useful if a modem's compression performance is limited by the
speed of its RS232 connection: eg. a Telebit with a 19200 baud
interface which can manage >9600 baud over the comms link. In this
case offline compression (as is widely used by "news") may be
preferable to the modem's built-in algorithms. If you run UUCP 
over TCP/IP this setup could also be adapted to reduce the traffic.

As well as reducing the size of mail transmissions by O(100%), it also
reduces the disk usage for spool directories by O(100%).

Obviously if mail transmission time or storage is not a bottleneck or a 
significant cost, then this is not for you...

Share and Enjoy!

-- Mike Bell -- <mb@sparrms.ists.ca>

----------------Use your logical scissors here--------------------------
#! /bin/sh
# This is a shell archive.  Remove anything before this line, then feed it
# into a shell via "sh file" or similar.  To overwrite existing files,
# type "sh file -c".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sources-unix@uunet.uu.net if you want that tool.
# If this archive is complete, you will see the following message at the end:
#		"End of archive 1 (of 1)."
# Contents:  cmail cmail/README cmail/rcmail cmail/sendmail.ed
#   cmail/uucx
# Wrapped by kent@sparky on Fri Mar 15 11:56:23 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test ! -d 'cmail' ; then
    echo shar: Creating directory \"'cmail'\"
    mkdir 'cmail'
fi
if test -f 'cmail/README' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cmail/README'\"
else
echo shar: Extracting \"'cmail/README'\" \(3568 characters\)
sed "s/^X//" >'cmail/README' <<'END_OF_FILE'
XSetting up a Compressed Mail Feed
X---------------------------------
X
X	IF 
X	    you have a large volume of mail
X	OR 
X	    a very slow UUCP modem connection
X	OR 
X	    you pay for your mail by volume
X	THEN 
X	    you should read most of this...		
X
XIf you have a *slow* modem without data compression, and a large volume
Xof mail traffic, the transmission of mail can sometimes clog up the modem
Xlink. And if you are unfortunate enough to have to pay for the phone
Xcalls, it can be expensive...
X
XIn this situation, you might like to consider a compressed mail feed.
X
XAnother situation in which such a feed may be useful, is if your modem
X(although it will compress data) is limited by the speed of its RS232
Xconnection (like our old 19200 baud Telebit TB+).
X
XThe feed, which needs to be set up at both ends of a uucp link, can
Xsubstantially reduce the volume of data transmitted.  The mail is
Xsimply compressed before transmission and uncompressed on receipt,
Xgiving an Order(100%) improvement in mail throughput. (This is similar
Xto the process used for Usenet news feeds).
X
XIn essence:
X
X   sendmail -> (compress | uux) -> UUCP/modem -> (uncompress | rmail)
X                ^^^^^^^^^^^^^^                    ^^^^^^^^^^^^^^^^^^
X                 program uucx                       program rcmail
X
XThe following are required:
X
X    rcmail 	- a compressed mail reader (analagous to rmail)
X    uucx   	- a compressed mail sender (used instead of uux)
X    sendmail.ed	- changes to UUCP mailer in sendmail.cf
X     (and)      - changing UUCP permissions to allow rcmail to execute   
X
XNB. If you have UUCP links with more than one site, you will either 
Xhave to all agree to change to a compressed feed, or hack the S0 rule set
Xto route the compressed mail via a different uucp mailer.
X
XIf your modem (and the one you connect to) use data compression, this
Xsetup will only produce a marginal gain in efficiency (since compress
Xwill normally beat a modem's own compression algorithm due to the
Xincreased space available for the LZW algorithms) unless the modem is
Xlimited by the speed of its RS232 connection (true for old 19200 baud
XTelebits).
X
XNote that this technique could also be exploited for non-modem based
Xlinks (eg. UUCP via TCP).
X
XInstallation (do this at both ends of the UUCP link)
X----------------------------------------------------
X
X0. Check the compress/uncompress options in uucx/rcmail suit your 
X   particular variety of Unix - mine's Sun OS4.1. The aim is to 
X   compress/uncompress standard input as appropriate.
X
X1. Install rcmail and uucx in the /bin directory. Make sure they
X   are both executable. Check that this is the same directoriy
X   that rmail and uux are in.
X
X2. Change the /etc/uucp/Permissions of /usr/lib/uucp/USERFILE (depending
X   on your version of UUCP) to allow "rcmail" to be executed by the
X   remote system as well as rmail. (Look for occurrances of "rmail", and
X   insert "rcmail" immediately afterwards.)
X
X3. Change you sendmail.cf file as indicated in sendmail.ed
X
X4. Kill and restart the sendmail daemon.
X
X5. Send a test message via the remote site to check it works.
X
X6. Have a cup of coffee, and congratulate yourself on saving communications
X   time and costs. 
X
X7. Write a memo to your manager explaining about this really neat idea
X   you had to reduce communication costs... (If he/she gives you an
X   immediate raise, don't forget my 10%!) On second thoughts, better
X   not in case it raises the question as to how much the electronic
X   mail actually cost in the first place...
X
X
XMike Bell <mb@sparrms.ists.ca> 5 March 1991
X
END_OF_FILE
if test 3568 -ne `wc -c <'cmail/README'`; then
    echo shar: \"'cmail/README'\" unpacked with wrong size!
fi
# end of 'cmail/README'
fi
if test -f 'cmail/rcmail' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cmail/rcmail'\"
else
echo shar: Extracting \"'cmail/rcmail'\" \(96 characters\)
sed "s/^X//" >'cmail/rcmail' <<'END_OF_FILE'
X#!/bin/sh
X# Mike Bell <mb@sparrms.ists.ca> 5 March 1991
X/usr/ucb/uncompress -c |  /bin/rmail $*
END_OF_FILE
if test 96 -ne `wc -c <'cmail/rcmail'`; then
    echo shar: \"'cmail/rcmail'\" unpacked with wrong size!
fi
chmod +x 'cmail/rcmail'
# end of 'cmail/rcmail'
fi
if test -f 'cmail/sendmail.ed' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cmail/sendmail.ed'\"
else
echo shar: Extracting \"'cmail/sendmail.ed'\" \(1014 characters\)
sed "s/^X//" >'cmail/sendmail.ed' <<'END_OF_FILE'
XEditing sendmail.cf
X-------------------
X
XYeah, I know... Not a pleasant thought...
X
XWhat you need to find is the mailer definition of the uucp mailer used
Xto talk to the adjacent site... Try looking for the string rmail in the
Xsendmail.cf file.
X
XOur mailer definition looks something like this:
X
X	Muucp, P=/usr/bin/uux, F=CmsDFMhuU, S=22, R=22,
X	        A=uux -  $h!rmail ($u)
X
XChange "uux" to "uucx" where it occurs (twice) and "rmail" to "rcmail"
Xto give something like:
X
X	Muucp, P=/usr/bin/uucx, F=CmsDFMhuU, S=22, R=22,
X	        A=uucx -  $h!rcmail ($u)
X
XIf you don't know which uucp mailer definition is being used (and there
Xis more than one), I'm afraid your just gonna have to read the manuals
X(look at the address test mode stuff). Also if you have more than one
Xuucp mail link, and they aren't all going to be compressed, you need to
Xgrok (~= understand) ruleset S0...  Try taking a combined training
Xcourse in Snobol and OPS-5 programming...  Such is life. (sigh!)
X
X-- Mike Bell -- <mb@sparrms.ists.ca>
END_OF_FILE
if test 1014 -ne `wc -c <'cmail/sendmail.ed'`; then
    echo shar: \"'cmail/sendmail.ed'\" unpacked with wrong size!
fi
# end of 'cmail/sendmail.ed'
fi
if test -f 'cmail/uucx' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cmail/uucx'\"
else
echo shar: Extracting \"'cmail/uucx'\" \(91 characters\)
sed "s/^X//" >'cmail/uucx' <<'END_OF_FILE'
X#!/bin/sh
X# Mike Bell <mb@sparrms.ists.ca> 5 March 1991
X/usr/ucb/compress -c | /bin/uux $*
END_OF_FILE
if test 91 -ne `wc -c <'cmail/uucx'`; then
    echo shar: \"'cmail/uucx'\" unpacked with wrong size!
fi
chmod +x 'cmail/uucx'
# end of 'cmail/uucx'
fi
echo shar: End of archive 1 \(of 1\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have the archive.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0
exit 0 # Just in case...
-- 
Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
Sterling Software, IMD           UUCP:     uunet!sparky!kent
Phone:    (402) 291-8300         FAX:      (402) 291-4362
Please send comp.sources.misc-related mail to kent@uunet.uu.net.