#!/usr/bin/perl -s # mimemix - construct and output a default MIME message from the given files # Steve Kinzler, kinzler@cs.indiana.edu, May 02 # http://www.cs.indiana.edu/~kinzler/home.html#unix $usage = "usage: $0 file ...\n"; die $usage if $h || ! @ARGV; use MIME::Entity; use MIME::Types; $entity = MIME::Entity->build(Type => 'multipart/mixed'); $types = MIME::Types->new; foreach (@ARGV) { print(STDERR "$0: skipping directory ($_)\n"), next if -d; /[^\/]\.([^.\/]*)\/*$/; $ext = ($1 ne '') ? $1 : (-B _) ? 'exe' : 'txt'; $entity->attach(Path => $_, Type => $types->mimeTypeOf($ext)->type, Encoding => -SUGGEST); } $entity->print;