[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Intent to package mime-construct

mime-construct is a program I wrote for constructing MIME messages.  It
is GPLed.  It's already packaged, I'm going to upload it now.

The program is entirely driven from the command line, it's meant to be
used by programs.  Here's the examples section of the man page.

   The examples assume than $nl contains a newline.  The
   other variables used are I hope self-explanatory.

   Send a simple message.

       mime-construct --to "$recip" --subject 'hi there' --string "$body"

   Send a message which is read from stdin.

       fortune | mime-construct --to "$recip" --subject fortune --file -

   Most people think of attachments as multipart messages,
   but they don't have to be.  This generates a zip of all
   the files in the current directory and sends them as an
   attachment but as a single part message.

       zip -q - * |
	   mime-construct --to "$recip" --subject 'zipped directory' \
	       --attachment dir.zip --type application/zip --file -

   This sends a zip file as an attachment in a multipart
   message, with some text in the first part.

       mime-construct --to "$recip" --subject 'Mars or bust' \
	   --string "$explanatory_text" \
	   --type application/zip --attachment $zip --file $zip

   You can use the full experessiveness of Perl's open() when
   constructing file names.  Eg, you can run processes

       mime-construct --to "$recip" --subject "$subject" \
	   --string "Here are those two files you wanted.$nl" \
	   --type application/x-gzip --file 'gzip -c file1 |' \
	   --type application/x-gzip --file 'gzip -c file2 |'

   or read from alternate filehandles (<&=4 to read from file
   descriptor 4) or whatever.  See the open() section of the
   perlfunc manpage for details.

   Here's an example of using a separate invocation of mime-
   construct to create a subpart.  This creates a message
   which has two parts at the top level.  The first part is
   some text, the second part is a digest.  The digest itself
   is a multipart message which contains a number of
   messages/rfc822 parts.

       for msg in $msg_list
	   msg_args="$msg_args --type message/rfc822 --file $msg"

       set fnord
       for recip in $recip_list
	   set "$@" --bcc $recip

       mime-construct --subpart --multipart multipart/digest $msg_args |
	   mime-construct \
	       --header "To: Digest recipients:;$nl" \
	       --subject 'Foo digest' \
	       "$@" \
	       --file $introduction \
	       --subpart-file -

Roderick Schertler

Reply to: