procmail
[Top] [All Lists]

Re: Split up outgoing autoreply file into separate emails?

1996-10-24 18:03:46
I've spent a few hours trying to find an archived message about this
particular problem.  The file that I've been sending out via autoreply has
grown considerably.  I've split the file up into chunks of about 50-60K,
and for folks whose mailboxes can handle large messages, I have set my
autoreply to cat the parts together and then send it out.

But some folks have mailboxes with message limits on them.  Is there any
way to send the parts out as separate messages, each labeled in the
Subject line as to what part it is, without requiring them to send
separate request messages?

The following recipe is from the file "commands.rc" in my procmail
library which takes my Emacs startup files and mails them as separate
files.  The reply header has already been setup, and the recipe
below generates several mail messages using the reply header.
The recipe doesn't know actually how many files there, but it
uses a glob to get them all (see the assignment of EMACSSETUP).

To generate a loop, just use a shell looping command like "for"
or "while" from a filter action "|".

    #####       send emacs setup
    :0 E
    * SUBJ ?? emacs(-| *)setup
    {
        # Send emacs setup (shar archive is several files)
        EMACSSETUP="$HOME/emacs/site-setup.shar*"
        count=`echo $EMACSSETUP | wc -w`

        # For this command, we are responding with several mails
        # so we cannot use procmail to "hold" them all at the
        # same time.  So, we generate several sendmail invocations
        # and leave the current mail buffer empty by filtering it
        # with /dev/null

        :0 f:tmp.reply.lock
        * $ ? test -f $EMACSSETUP
        | cat - > tmp.reply ; \
          i=1 ; \
          for file in $EMACSSETUP ; do \
              cat tmp.reply $file \
              | formail -I "Subject: Re: $SUBJ [part $i/$count]" \
              | $SENDMAIL -oi -t ; \
              i=`expr $i + 1` ; \
          done ; \
          cat /dev/null

        :0 Efb
        | cat - ; \
          echo "Sorry, the emacs setup archive file is not currently available."
    }

Hope this helps.
___________________________________________________________
Alan Stebbens <aks(_at_)sgi(_dot_)com>      http://reality.sgi.com/aks

<Prev in Thread] Current Thread [Next in Thread>