NIU Department of Mathematical Sciences
Most e-mail systems transmit only the basic ASCII character set, which is the lowest common denominator in the computer world. However, you will often need to send (or receive) a file in a different format, such as a binary executable program or a .dvi file.
Most of what follows applies to Unix systems. Modern Mac and PC mail applications such as Eudora or Pegasus Mail handle this problem by using so-called MIME attachments (explained below).
The Unix utility uuencode and its companion uudecode
were designed to solve this problem: they are used to convert a binary
file into an ASCII equivalent, and to restore the original file from
the ASCII representation. However, this method has disadvantages and
should not be used unless it's necessary.
Modern standards call for compliance with MIME (Multipurpose Internet Mail Extensions), which uses primarily something called a base 64 encoding method. Whenever you receive a mail message marked as containing MIME content (e.g. in elm it will be marked with an M next to it), chances are that it was encoded using base64.
mpack -o program.enc programThis will create a file `program.enc' containing the ASCII form of the binary file. You can now send it by regular e-mail (but see below for a simpler method).
Note: there is no point at all in uuencoding plain text files such as PostScript or TeX!
Some mail programs let you specify what "attachments" should be added to the letter. In pine there is a menu choice for doing this. In elm you can say something like
[include paper.dvi application/octet-stream base64]in the body of the letter, and the file `paper.dvi' will be encoded and attached to your message according to MIME conventions.
You could of course use the editor to simply read in the already encoded file into the text of your letter, but you shouldn't do that: none of the special MIME mail headers will be created in this case, and the recipient's mail program will not be able to decode the file automatically.
Probably the fastest (and recommended) way to send a binary file
to someone is to use our friend mpack in mail mode.
To send a file `paper.dvi' to someone just type
mpack -s "Here is my paper" paper.dvi someuser@some.place.edu
If nothing like this has happened (e.g. if you use ordinary Unix mail, which knows nothing about MIME), then you should first save the message to a file, and then decode it manually. For example, if the letter was saved in a file called `from-bob', then at the Unix shell prompt simply type
munpack from-bobDo not remove mail headers from the file before running it through munpack. The program needs some of them to do the work, and is smart enough to skip all others.
The decoder is also very careful about not overwriting existing files. If the resulting file was supposed to be called `program' but you already have a file by that name, munpack will use the name `program.1' or some such.
You should now learn to use FTP to transfer the file from your Unix account to a PC or a Mac. Remember that you will need to use the binary or MacBinary transfer mode.
Obviously, the process can be reversed. If you want to send someone an Excel document, first upload it to your Unix account, and then use mpack to mail it, as described above.
Given a file `myfile', type
gzip myfileYou will get a file `myfile.gz', which will be anywhere from 10% to 50% smaller than the original. The file can be restored to its normal form with
gunzip myfile.gz'Trouble with this is that the compressed file is binary, even if the original was plain text. This means that you always have to encode it before sending (see above).
ftp://ftp.math.niu.edu/pub/contriband tell the browser to upload the file.
When this is done, you should notify the system manager so he can transfer the file to your home directory.
If you want to transfer a large file to someone, that person should ask the local system administrator to make similar arrangements for a "drop box" directory on the remote system.
If you are not too concerned about others getting the file, an even better choice is to place it on your personal Web page under some non-trivial name which won't be easy to guess by casual "surfers". The other person can then retrieve it using the full URL of the file, e.g.:
http://www.math.niu.edu/~behr/bizarrename.htmlYour homepage must contain a readable file called `index.html', or else anyone accessing that page will see a listing of all the files, which defeats the semi-privacy of this scheme.
Please do not let other
people use your password to transfer
files directly to or from your account!
Large PostScript files (a megabyte or more) can fail to print on a Unix computer unless you use the -s option to lpr, e.g.
lpr -s -Pm1 hugefile.ps