10.1  THE FILE'S IN THE MAIL


E-mail by itself is a powerful tool, and by now you may be sending e-mail 
messages all over the place.  You might even be on a mailing list or two. 
But there is a lot more to e-mail than just sending messages.  If your 
host system does not have access to ftp, or it doesn't have access to 
every ftp site on the Net, you can have programs and files sent right to 
your mailbox.  And using some simple techniques, you can use e-mail to 
send data files such as spreadsheets, or even whole programs, to friends 
and colleagues around the world. 

A key to both is a set of programs known as encoders and decoders.  For 
all usefulness, basic Net e-mail has a big problem: it can't handle 
graphics characters or the control codes found in even the simplest of 
computer programs. Encoders however, can translate these into forms 
usable in e-mail, while decoders turn them back into a form that you can 
actually use. If you are using a Unix-based host system, chances are it 
already has an encoder and decoder online that you can use. These 
programs will also let you use programs posted in several Usenet 
newsgroups, such as comp.binaries.ibm.pc. 

If both you and the person with whom you want to exchange files use Unix 
host systems, you're in luck because virtually all Unix host systems have 
encoder/decoder programs online.  For now, let's assume that's the case. 
First, upload the file you want to send to your friend to your host site 
(ask your system administrator how to upload a file to your name or 
"home" directory if you don't already know how).  Then type 
 
     uuencode file file > file.uu
 
and hit enter. "File" is the name of the file you want to prepare for 
mailing, and yes, you have to type the name twice!  The > is a Unix 
command that tells the system to call the "encoded" file "file.uu" (you 
could actually call it anything you want). 

Now to get it into a mail message.  The quick and dirty way is to type 
 
    mail friend
 
where "friend" is your friend's address.  At the subject line, type the 
name of the enclosed file.  When you get the blank line, type 
 
    ~r file.uu
 
or whatever you called the file, and hit enter. (on some systems, the ~ 
may not work; if so, ask your system administrator what to use).  This 
inserts the file into your mail message.  Hit control-D, and your file is 
on its way! 

On the other end, when your friend goes into her mailbox,  she should 
transfer it to her home directory.  Then she should type 
 
     uudecode file.name
 
and hit enter.  This creates a new file in her name directory with 
whatever name you originally gave it.  She can then download it to her 
own computer.  Before she can actually use it, though, she'll have to 
open it up with a text processor and delete the mail header that has been 
"stamped" on it.  If you use a mailer program that automatically appends 
a "signature," tell her about that so she can delete that as well. 

The past couple of years have seen the development of the Multi-purpose 
Internet Mail Extensions (MIME), which make e-mailing these files 
even easier.

If you use an e-mail program such as cc:Mail or Microsoft Mail at work, 
or if you dial into bulletin-board systems, then you're used to the idea 
of file attachments -- you write a message, and then tell the computer 
you want to attach a file.  MIME is essentially the Internet equivalent. 
The one caveat is that your recipient also has to have a MIME-enabled 
mail program; otherwise you could run into problems (and in that case, 
you'll have to fall back on uuencode).

Probably the best way to use MIME on a Unix public-access site is with 
Pine -- it makes it very easy.  Let's say you've just uploaded a graphics 
file that you want to mail to a friend.  Call up Pine and start a message 
to your friend.  With the cursor still in the header area (i.e., the area 
where you put in his e-mail address), hit control-J.  You'll be asked for 
the name of the file you want to attach.  Type in its name (or path if you 
put it somewhere besides your home directory) and that's it!  You can now 
compose a message to your friend and then send it off as you would 
normally (only now it will come with an attached file). 

Assuming your recipient also uses Pine, when he gets your message, one of 
his options will be to hit control-V. If he hits that, he'll be asked if 
he wants to view or save the attached file.  Assuming it's a binary file, 
he should hit his s key and then type in the name of the file under which 
to save the attachment.  When he exits Pine, he can then download the file 
-- without the muss of first uudecoding it. 

A number of companies now sell software that lets users of proprietary e-
mail systems send and receive MIME attachments.  So if you plan on 
exchaning binary files with somebody on one of these systems (our friend, 
the cc:Mail user, for example) -- ask if her system can accept MIME 
attachments.  It will make life a lot easier for both of you.