We need a way to send e-mail with file(s) attachments from Unix systems running sendmail that will work in a Unix script so Windows based recipitants can save the attachments? We would call this script from a cron job to send an e-mail with the file(s) in a specific location attached.
We need to do this on both AIX 4.3 and Solaris 8. These systems have working e-mail but without a program like Pine or Mutt we are unable to send attachments in a format that a Windows / Outlook user can work with. Some of these attachments are over 5 Megs. Thank you for your time.
First you may want to check your sendmail.cf to make sure there is no maximum limit in the max message size that may be 5mg or higher:
maximum message size
If it is 5mg, like it is above, increase the size to a large amount.
There are many ways that you code script e-mail from Unix. One way is to use the following syntax, which is the simplest method, sending data read from standard input:
$ mail -s "see attached file" root < /tmp/testfile.log.
Unfortunately on many occasions, especially with binary files, this does not work with many PC type e-mail readers. Mail delivery agents may transform the message by stripping the 8th bit of each character, or removing tab or blank spaces. Other more reliable methods of sending e-mail are with uuencode or MIME.
The uuencode solution is to encode the mail from binary format to a text format that is safe to transmit. The program is called "uuencode" ("UNIX to UNIX encoding"), the program to decode the data is called "uudecode".
The syntax you may use would be similar to this:
uuencode house.jpeg house.jpeg | mail firstname.lastname@example.org
The disadvantage for you here is that some mail programs to not have an automatic decoder that will enable the user to read these files.
The safest bet may be to use a Mime compatible software package, something like MetaMail. You can download this from the net at: ftp://thumper.bellcore.com/pub/nsb/
This was first published in January 2003