I like MIME.

If you also like MIME perhaps you will find this script interesting.
It runs under Linux (bash).

mimesend allows you to build sophisticated and funny MIME messages. It allows recursion, so you can put MIME blocks inside others with a single command.

Download mimesend v 1.5 .

Unpack the tarball.
Execute (as root) m-install to install it.
Execute man mimesend to read how to use it.

Bugs to me.

I like SMIME.

mimesend also has powerful support for SMIME.

You need to install openssl (configure and make procedure) before running m-install.
smimedec is a simple script that tries to decrypt and verify signatures on SMIME messages.

Here you can see some mimesend examples:

MIME Examples.

To build, but do not send, a mail with two files:
 mimesend -o -\
  -t none@none.at.all \
  -i -e base64 -m image/gif -f sound2.gif \
  -i -e base64 -m text/html -f mimesend.html \
  -s 'Two files for you'
This command sends a mail for every directory inside the first level of the current dir, with all the files contained in it:
 for f in $(find * -type d -maxdepth 0 -print); do
   mimesend \
    -t none@none.at.all \
    -f $f \
    -j "Files on $f"
Now, we send all the files in a single mail, separating them with a block containing his name:
 eval mimesend \
   -t none@none.at.all \
   -j \"All the files/dirs follows\" \
   $(for f in $(find * -type d -maxdepth 0 -print); do
       echo " -r '-j \"----- Files on $f -----\" -h $f'"
or simply:
 eval mimesend \
   -t none@none.at.all \
   -j \"All the files/dirs follows\" \
   $(for f in $(find * -type d -maxdepth 0 -print); do
       echo "-h $f"
or more simple and nice:
 mimesend \
   -t none@none.at.all \
   -j "All the files/dirs follows" \
   -H "$(find * -type d -maxdepth 0 -print)"
Several nice examples:
 mimesend -r "-r '-r \"-r '\''-j message'\''\"'" -t none@none.at.all
 mimesend -r "-j m1 -r '-j m2 -r \"-j m3 -r '\''-j m4'\''\"'" -t none@none.at.all
 mimesend -r "-j m1 -r '-j m2 \
 	-R\" -F me@you -s hello -t you@me \
 	     -j m31 -r'\'' -j m32'\''\"'" -t none@none.at.all
Spending the time:
 x=""; r1=""; r2=""
 for f in 1 2 3 4 5 6 7 8 9; do
   r1="$r1 -r $x\" -j m$f "

 eval mimesend -n $r1$r2
A little more:
 x=""; r1=""; r2=""
 for f in a b c d e f g h i; do
   r1="$r1 -r $x\" -j $y\"Block $f$y\" "
 eval mimesend -n $r1$r2
An exotic example:
 mimesend -o - <<-EoF -a -j "This is plain text" -f -
 This is HTML text
A better example (a nice feature):
 mimesend -j '<html>This is always' -l '<html>This is true HTML' \
          -j 'text/plain' -l '<html>This is another block' -o -
 mimesend -j 'Attached is the HTML text' \
 	  -j 'You should not be reading this' -a \
          -l '<html>
	  This is autodetected HTML text.
	  <ul><li>An item.
	  </ul>' -t none@none.at.all
Embeding objects using multipart/related:
mimesend -x -l '<html>
<body background="%%2%%">
<hr><center><img src="%%3%%"></center>
This is a simple html page embeded in mail.
' -f nisubg.gif -f nisu.gif -t none@none.at.all
Another example:
 (echo '<html>'
  for f in $(find -type f -name \*.gif) ; do
    echo "Image #$[c-1](${f##*/})<img src=\"%%$c%%\"><br>"
 ) | mimesend -x -f - -f \*.gif -t none@none.at.all
The same, but can fail for non ordinary filenames:
  mimesend -x -l \
    "<html>$(find -type f -name \*.gif -printf "Image %f: <img src=\"%%%%:%f%%%%\"><br>\n")" \
    -I : -f \*.gif -t none@none.at.all
How to build one message that contains a complete readable mailbox:
  mimesend -o singlemail -e 8 -m "message/rfc822" -i \
           -H "$(formail -s <themailbox \
	         bash -c "fil=dump.$$"'.$FILENO.mail; echo $fil; cat >$fil')"
  rm dump.$$.*.mail

SMIME examples.

We send a two-line message, the file design1.gif, and two MIME blocks:
 mimesend \
  -s "Test level 2 anidation" \
  -t none@none.at.all \
  -j "First line." \
  -F "I am <nobody@at.nowhere>" \
  -m image/gif -f design1.gif \
  -r "-m -D 'Another design' -f design2.gif \
      -f page.html \
      -C dest.pem -E des \
     " \
  -R "-j this -j 'This is a simple mail.' \
      -f design3.gif \
      -d preformatedMIME.dat \
      -S demo-invalid.pem -s \"Signed mail inside\" \
     " \
  -j "Second line of the same block."
If you have all your foreign certs in the directory 'email_certs', you can send an encrypted mail to a lot of addresses, that you have stored in a file:
 mimesend -t "$(cat people)" -C email_certs -C my_cert -j "small message"
but only a big message will be sent, as all recipes are codified into the pkcs7 structure. The alternative:
 mimesend -T -t "$(cat people)" -C email_certs -C my_cert -j "small message"
sends one different really small message for every address. See note about -C .

Suposse that you have a cert for hidden@none.none but not for none@none.at.all. This command gives a warning, that you should consider:

 mimesend -f file1 -r '-t hidden@none.none -f file2 -C somedir' -t none@none.at.all
For more examples, see the (S)MIME examples (in spanish).