Columbia MM
MM Manual

USING UUENCODE TO MAIL WORD PROCESSOR FILES AND OTHER BINARIES

Electronic mail was designed to accept only plain text: letters, numbers, punctuation marks. Compressed files and compiled programs are examples of files that are not plain text, but what is known as binary files. Many word processors and other programs running on microcomputers (such as IBM-PC and clones, IBM PS/2, Macintosh) do not store data as plain text but as binary files. For this reason, you cannot use electronic mail to send a word processor file. One solution is to save the file as plain text (ASCII), but in doing so you lose most of the formatting of the document.

Most of this section explains the use of uuencode to convert a binary file into a pseudo-ASCII text that can be mailed, and the use of uudecode to convert such a message back into a binary file. Before sending, check with your correspondent that the document can be uudecoded on the receiving system and that the binary file can be used. Besides the following explanation, see also the man page, by typing man uuencode at the system prompt. The man page illustrates the use of uuencode with the Berkeley mail program; the purpose of the examples here is to show how to adapt it to MM. If you know how to use Berkeley mail, you may find it simpler to send uuencoded material with it.


UPLOADING AND DOWNLOADING BINARY FILES

If the file originates on your microcomputer, you need to upload it as a binary, and the same applies if you want to download a binary file that you receive. File transfer usually assumes plain text, so check on how to send and receive a binary. With Kermit, you give the command set file type binary to both Kermit programs as shown below.



$ kermit
C-Kermit, 4F(095)  31 Aug 89, 4.2 BSD
Type ? for help
C-Kermit>set file type binary
C-Kermit>receive myfile
Escape back to your local Kermit and give a SEND command...
[alt-x]
Kermit-MS>set file type binary
Kermit-MS>send myfile.wp



SENDING A MESSAGE WITH UUENCODE

On the mail host, use the uuencode command to create a coded version of the file. The resulting file, file2, is approximately 35% larger than the binary file1. Since it is made of text characters, it can be sent through electronic mail.

The syntax of the command is: uuencode file1 name > file2

file1 is the name of the file you created when you uploaded the file with Kermit; it is the binary file. name is the name that is to be included in the encoded version of the file; it may or may not be the same as file1. file2 is the name of the encoded file that you are creating with the command.

In this example the binary myfile is converted to myfile.uu:



$ uuencode myfile myfile > myfile.uu


Then use MM to include myfile.uu into a message, like any file.



 Message (End with CTRL/D or ESC
  Use CTRL/B to insert a file, CTRL/E to enter editor, CTRL/F to run text
  through a filter, CTRL/K to redisplay message, CTRL/L to clear screen and
  redisplay, CTRL/N to abort, CTRL/P to run a program and insert output.):

[control-b]
Insert file: myfile.uu
[OK]

[escape]
S>send



RECEIVING A MESSAGE WITH UUDECODE

When you receive a uuencoded message, you need to reverse the procedure. First save the message to a file with copy or list. In this example the list command copies the message into a file called herfile.uu (an arbitrary name).



R>list herfile.uu


Convert it back to a binary file with uudecode to convert it back. The command takes just the name of the uuencoded file, and creates a file using the name given when the file was uuencoded. The mail headers at the beginning of the file are ignored, so the result should be exactly like the original binary file.

Here herfile.uu is uudecoded. The resulting file will be called myfile if it is the one that was sent in the earlier example. You can of course rename the file after it is uudecoded, and you can download it to your microcomputer if that's appropriate.



$ uudecode herfile



BINHEX FOR THE MACINTOSH

Several free or shareware applications for the Macintosh will convert Macintosh files into BinHex format, which is considered ASCII text. If you and a correspondent both have Macintosh computers, you will find this an easy way to send formatted Macintosh files through electronic mail. You can upload and download as text, and mail without using uuencode.


[ Columbia MM Manual ]