Using e-mail

Sending large files via mail

Some mail sites and networks limit the size of message you can send. This limit may be as large as 100KB or as small as 10KB. If, for example, you want to include a large file (above 32KB) in a message, the recipient may find that part of the file has been lost during the transfer, although no error message will appear.

A solution to this problem is to compress and encode a file before including it in your message. Compressing a file reduces its size by about 60%; encoding the file increases the size of the compressed file by about 25%, so you end up with a compressed and encoded file that is about half the size of the original. If this still leaves a file that is too large to send, you should, if possible, split the file into smaller files before compressing and encoding them using the split(C) command.

Compressing and encoding a file

You should encode a compressed file before you send it because compressed files may include characters that mail cannot recognize. Although you may be able to send the compressed file, it may well hang the recipient's terminal when they try to read it.

Assume that you have a file called myfile that you want to send via mail to one of your colleagues. To compress the file, type:

compress myfile

The name of the file is changed to myfile.Z, where the "Z" identifies that the file is compressed. The original file is overwritten by the compressed file. (You can use the -c option with compress if you want to keep a copy of your original file.)

To encode the compressed file, type:

uuencode myfile.Z myfile.Z > myfile.Z.uue

(You can give the encoded file any name you wish, but it is sensible to attach .uue to the end of it to identify that it is a file encoded using uuencode.) You can then include myfile.Z.uue in a message as described in ``Including a file or a message in mail''.

Decoding and uncompressing a file

A received message that includes a compressed and encoded file will look something like:

   Hi Robert,

This is the bitmap image that I promised to send you last week. I have compressed and uuencoded it. Save this message, uudecode and uncompress it to restore the image file:

begin 664 myfile.Z M+DY4"DEF('EO=2!A<F4@:6YS=&%L;&EN9R!T:&4@3&EN:R!+:70@;VX@86X@ M7',M,4E"35QS*S$@36]D96P@-38O-3<Z"BAA*2!I;G-T86QL('1H92!,:6YK . . . M(#4W+"!A<PID97-C<FEB960@8GD@=&AE(%QS+3%)0DU<<RLQ(#4W(%-U<'!L 896UE;G0@0V]V97(@3&5T=&5R+@HN3D0* end

That's it - look forward to seeing the results!

------------------- See y'all soon. Vic

The first line of the encoded file included in the message reads:
   begin 664 myfile.Z
The entry myfile.Z is the name that the decoded file will be given; 664 specifies the absolute octal permissions on the file.

Save the whole message as a_message (or give it any name you want).

To decode the file, type:

uudecode a_message

By default, the decoded file is called myfile.Z. If you wish to override this, use the -s option of uudecode and direct its standard output to the filename to be created; in this example, to ourfile.Z:

uudecode -s a_message > ourfile.Z

The final step is to uncompress the file. To uncompress myfile.Z, enter:

uncompress myfile.Z

The uncompressed file is called myfile (the name it had before it was compressed and encoded).

See also the compress(C) and uuencode(C) manual pages.

Next topic: Running UNIX commands from within mail
Previous topic: Reading an attachment

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003