The shell script requires that your Mac be configured as a mail server that can send mail using the sendmail command (Mac OS X 10.3 uses postfix, but it still has a sendmail command for compatibility purposes). The script also requires perl with the MIME::Base64 package installed. This package comes with Mac OS X 10.3 (10.2.x users must install it, though). The one modification I made to the script is to change the /usr/bin/sendmail command to /usr/sbin/sendmail, the correct path on Mac OS X.
Here is how to make it work.
- Download the script.
- Save it to a directory in your path with an appropriate name (i.e., mail_files).
- Make the file executable by entering:
% chmod u=rwx,go=rx mail_files
Installing the MIME::Base64 package on Mac OS X 10.2.x
- Download the MIME::Base64 package from CPAN.
- Go to the directory where you downloaded the file. Decompress and unpack with the command:
% tar -zxvf MIME-Base64-3.00.tar.gz
- Go to the new MIME-Base64-3.00 directory:
% cd MIME-Base64-3.00
- Build a makefile, compile the package, and install it in the default location:
% perl Makefile.PL % make % sudo make install
Using the Script
If you just installed the script into a directory in your path, be sure to enter the rehash command to make sure that your shell knows it is there. Enter the mail_files command with no arguments for a short description of the options. Here is an example of how to use the command:
% mail_files -t recipient@email.address -s subject -b attachedFileName Enter your message text here in as many lines as necessary with control-D at the end. [Ctrl-D]Edit the script for a detailed description of all the options in the comments. E-mail away!

