10.4  GETTING FTP FILES VIA E-MAIL

To help people without ftp access, a number of ftp sites have set up mail 
servers (also known as archive servers) that allow you to get files via 
e-mail.  You send a request to one of these machines and they send back 
the file you want.  As with ftp, you'll be able to find everything from 
historical documents to software (but please note that if you do have 
access to ftp, that method is always quicker and ties up fewer resources 
than using e-mail). 

Some interesting or useful mail servers include: 

      mail-server@rtfm.mit.edu  Files of "frequently asked questions" 
related to Usenet; state-by-state lists of U.S. representatives and 
Senators and their addresses and office phone numbers. 
      archive-server@cs.widener.edu  Back copies of the Computer 
Underground Digest and every possible fact you could want to know about 
"The Simpsons." 
      netlib@uunet.uu.net  Programs for many types of personal computers; 
archives of past postings from many Usenet newsgroups. 
      archive-server@ames.arc.nasa.gov  Space-related text and graphics 
(GIF-format) files. 
      service@nic.ddn.mil  Detailed information about Internet. 

Most mail servers work pretty much the same -- you send an e-mail message 
that tells them what file you want and how you want it sent to you.  The 
most important command is "send," which tells the computer you want it to 
send you a particular file. 

First, though, you'll need to know where the mail server stores that 
file, because you have to tell it which directory or sub-directory it's 
in.  There are a couple of ways to do this. You can send an e-mail 
message to the archive-server that consists of one line: 
 
     index
 
The server will then send you a directory listing of its main, or root 
directory.  You'll then have to send a second message to the archive 
server with one line: 
 
     index directory/subdirectory
 
where directory/subdirectory is the directory path for which you want a 
listing.  An alternative is to send an e-mail message to our old friend 
archie, which should send you back the file's exact location on the 
archive-server (along with similar listings for all the other sites that 
may have the file, however) 

Once you have the file name and its directory path, compose a message to 
the archive server like this: 
 
     send directory/subdirectory/file 
  
Send off the message and, anywhere from a few minutes to a couple of days 
later, you'll find a new message in your mailbox: a copy of the file you 
requested.  The exact time it will take a file to get to you depends on a 
variety of factors, including how many requests are in line before yours 
(mail servers can only process so many requests at a time) and the state 
of the connections between the server and you. 

Seems simple enough. It gets a little more complicated when you request a 
program rather than a document.  Programs or other files that contain 
unusual characters or lines longer than 130 characters (graphics files, 
for example) require special processing by the mail server to ensure they 
are transmitted via e-mail.  Then you'll have to run them through at 
least one converter program to put them in a form you can actually use.  
To ensure that a program or other "non-mailable" file actually gets to 
you, include another line in your e-mail message to the server: 
                                            
     encoder                      
 
This converts the file into an encoded form.  To decode it, you'll first 
have to transfer the file message into a file in your home directory.  
    
One further complication comes when you request a particularly long file.  
Many Net sites can only handle so much mail at a time.  To make sure you 
get the entire file, tell the mail server to break it up into smaller 
pieces, with another line in your e-mail request like this: 
 
     size 100000
 
This gives the mail server the maximum size, in bytes, of each file 
segment.  This particular size is good for UUCP sites. Internet and 
Bitnet sites can generally go up to 300000.  When you get all of these 
files in mail, transfer them to your home directory.  Exit mail and call 
up each file in your host system's text processor and delete each one's 
entire header and footer (or "signature" at the end).  When done with 
this, at your host system's command line, type 
 
     cat file1 file2 > bigfile
 
where file1 is the first file, file2 the second file, and so on.  The > 
tells your host system to combine them into a new megafile called bigfile 
(or whatever you want to call it).  After you save the file to your home 
directory (see section 10.2 above), you can then run uudecode, tar, etc. 
One word of caution, though: if the file you want is long enough that it 
has to be broken into pieces, think of how much time it's going to take 
you to download the whole thing -- especially if you're using a 2400-baud 
modem! 
     
There are a number of other mail servers.  To get a list, send an e-mail 
message to mail-server@rtfm.mit.edu: 
 
send usenet/comp.sources.wanted/How_to_find_sources_(READ_THIS_BEFORE_POSTING)
 
You'll have to spell it exactly as listed above.  Some mail servers use 
different software, which will require slightly different commands than 
the ones listed here.  In general, if you send a message to a mail server 
that says only 
 
     help
 
you should get back a file detailing all of its commands. 
     
But what if the file you want is not on one of these mail servers?  
That's where ftpmail comes in.  Run by Digital Equipment Corp. in 
California, this service can connect to almost any ftp site in the world, 
get the file you want and then mail it to you. Using it is fairly simple 
-- you send an e-mail message to ftpmail that includes a series of 
commands telling the system where to find the file you want and how to 
format it to mail to you. 

Compose an e-mail message to 
 
     ftpmail@decwrl.dec.com
 
Leave the "subject:" line blank.  Inside the message, there are several 
commands you can give.  The first line should be 
 
     reply address
 
where "address" is your e-mail address. The next line should be 
 
     connect host
 
where "host" is the system that has the file you want (for example: 
wuarchive.wustl.edu). Other commands you should consider using are 
"binary" (required for program files); "compress" (reduces the file 
size for quicker transmission) and "uuencode" (which encodes the file 
so you can do something with it when it arrives).  The last line of 
your message should be the word "quit".  

Let's say you want a copy of the U.S. constitution.  Using archie, you've 
found a file called, surprise, constitution, at the ftp site 
archive.cis.ohio-state.edu, in the /pub/firearms/politics/rkba directory. 
You'd send a message to ftpmail@decwrl.dec.com that looks like this: 
 
     reply adamg@world.std.com
     connect archive.cis.ohio-state.edu
     binary
     compress
     uuencode
     get pub/firearms/politics/rkba/constitution
     quit
 
When you get the file in your mailbox, use the above procedure for 
copying it to a file.  Run it through uudecode.  Then type 

     uncompress file.name

to make it usable.

Since this was a text file, you could have changed the "binary" to 
"ascii" and then eliminated the "uuencode" file.  For programs, though, 
you'll want to keep these lines.  One caveat with ftpmail: it has become 
such a popular service that it could take a week or more for your 
requested files to arrive.