Audience: Intermediate ECE UNIX system users Summary: Tells how to send binary (and other non-ASCII) files through electronic mail. From: ECE system administration office
I. Overview
II. General Procedure
III. Example
IV. For More Information
I. Overview
The ECE electronic mail system expects your mail
messages to consist entirely of ASCII characters. But what if you want to
include a binary (or other non-ASCII) file in an e- mail message? This document
describes one way to do this.
You use a standard UNIX utility called "uuencode" to create a special all-ASCII representation of your binary file. The resulting text file can then be sent through e-mail just like any text file.
The recipient of the encoded file then uses another UNIX utility called
"uudecode" to put the file back into its original binary form.
II. General Procedure
The SENDER of the binary file should...
uuencode <binfile> <binfile> > <txtfile> <RET>
2. E-mail the encoded file:
Include <txtfile> in e-mail message as an ordinary text file.
The RECIPIENT of the e-mail message should...
uudecode <encodedfile> <RET>
III. Example
Let's say you have a binary file called "a.out" that
you want send to your friend Liza.
uuencode a.out a.out > a.txt <RET>
(Note that you need to specify the filename "a.out" twice.)
2. You add a personal note:
You open up the file "a.txt" in your usual text editor, and add a note to Liza at the top.
Your completed message looks like this --
Dear Liza,
Here's my program "a.out". Decode it with "uudecode". Let me know what you think!
--Gern
begin 755 a.out M*B "E *@!)0"0 H7 0U"+A8 , C" &'H@) 0* 0! M ! @, 0 $ (N<(Z @0 ("P$ ! @, 0 )WC M"!$ B0$B'L0 2Y(0( "L$ (D@.@7$ $N4$" @@*(@ ... M "6$N 2F! %D "N:$ 4+P "*X5XE01 (D!(A^T M",(#H&B D ! H "R BN%>(HD 3 $I(0 !&4$" '%R end
3. You mail the message:
Now you mail the file "a.txt" to Liza, whose e-mail address you know to be "liza@merle.acns.nwu.edu".
(If you use the mail program Elm, you can type "elm liza@merle.acns.nwu.edu < a.txt <RET>" at the UNIX prompt.)
The next time Liza reads her mail, she sees your message. In order to restore the encoded file you sent her to its original format, she does the following two things:
From within her mail program, Liza saves your message in her current directory under the name "gern". (Different mail programs have different ways for doing this. From the main screen of Elm, for example, she would select your message and type "s gern <RET>".)
2. Liza decodes the file:
She quits her mail program, and types the following command at the UNIX prompt:
uudecode gern <RET>
And that's it! Liza now has an exact copy of your ori- ginal binary file
"a.out" in her current directory!
IV. For More Information