[Exim] batching and compression

Top Pagina
Delete this message
Reply to this message
Auteur: Randy Bush
Datum:  
Aan: exim users
Onderwerp: [Exim] batching and compression
i still deal with long thin wires, so i have tried to move an old smail hack
to exim. further clues appreciated.

randy


---------------- inbound ----------------

% cat /bin/rcsmtp
#! /bin/sh

# Receive compressed batches of SMTP commands and send them to exim.

# Filename /bin/rcsmtp - the batched/compressed mail packet generated by
# the remote cbsmtp will be 'mailed' via uux to this-system!rcsmtp.

# Therefore 'rcsmtp' must somehow be set up in the config file and be
# found on uux's path.

# This just uncompresses and feeds it into 'rmail' which is just exim in
# disguise ...

/usr/bin/gunzip -c | /bin/rmail

exit 0

---------------- outbound ----------------

exim transprt:

uubatch:
driver = appendfile
directory = /var/spool/uucp/OUTQ/${host}
bsmtp = all
prefix =
suffix =
user = uucp

---

exim router:

force_uucp:
driver = domainlist
route_file = /usr/local/etc/exim/ro.uucp
search_type = partial-lsearch

---

/usr/local/etc/exim/ro.uucp:

# Domain                Relay                   Transport
# ------                -----                   ---------
#...
#
test            test            uubatch
#


---

/usr/local/bin/cbsmtp:

#! /bin/sh

# invoked by cron.

# deliver messages accumlated into subdirectories of the outq spool directory.
# subdirectory names are based on the actual hostnames involved.

# may be invoked as
# cbsmtp
# to batch for all hosts
# or as
# cbsmtp <hostname>
# to batch only for one host

# This will pick up outgoing mail, batch it, put an SMTP 'envelope' around it,
# compress and fire off a uux.

OUTQ="/var/spool/uucp/OUTQ"

cd $OUTQ

if [ "$#" -eq 0 ]; then
hosts="*"
else
hosts="$*"
fi

for host in $hosts; do
   (
      cd $OUTQ/$host
      files=`echo q*`
      if [ "$files" = "q*" ]; then
         exit
         fi


      (
     while true; do
            files=`echo q*`
            if [ "$files" = "q*" ]; then
               exit
               fi
            (
               echo "HELO `hostname`"
           for file in $files; do
                  cat $file
                  rm $file
          done
           echo "QUIT"
              ) | /usr/bin/gzip -9 -c | /usr/bin/uux -r -z - $host!$rcsmpt
            done
         )
      cd ..
      )
   done


exit 0


-30-