Email is the most basic form of data transfer on the Internet. If you have access to the Internet, through either a simple shell account or a full TCP/IP connection, then you most likely have email capability. If you need to send one or more graphics files to only a few people, email is the best way to do so.
If you are going to email graphics files, then you must first convert them from binary to ASCII data. Sophisticated mail programs will transparently perform the binary-to-ASCII translation for you when sending mail and will convert the file back again when it is received. But not everyone has such a mail program, so let's look at how we would manually control this process.
We already know how to use uuencode to create an ASCII file from binary data. A uuencoded file may be emailed as you would any other text file, for example:
uuencode toshi.jpg toshi.jpg > toshi.uue Mail -s "JPEG file of my cat" user@site.domain < toshi.uue
This example shows the two commands used to uuencode and email the graphics file toshi.jpg using the Berkeley UNIX mail program. The person receiving the email will see the uuencoded data of a file named toshi.jpg. All that person needs to do is save the email to a file and uudecode it.
One other way of sending binary files via email is by using Multipurpose Internet Mail Extensions (MIME). MIME is an extension of the Internet's Simple Mail Transfer Protocol (SMTP) and is a common way to move multiple items of data as a single package across the Internet. MIME has a method of sending binary information in an email message that allows you to avoid the uuencode/uudecode steps. In fact, any MIME-compliant email program does all the work for you. All you need to do is specify that a file (often called an attachment) is to be sent using MIME. The other half of the bargain is that the person receiving your email must also be using a MIME-compliant email program to decode your MIME-encoded binary file.
Email etiquette for graphics files is mostly about bandwidth. The email that you send may seem to travel directly from you to your friends, but it does so by passing through possibly dozens of computers, which costs the other people who use those computers each a small bit of time and money. Therefore, avoid sending large volumes of email, especially in a short period of time.
If you must email a file larger than 64K in size, split it into several smaller parts and email them separately. Older mailer software frequently cannot handle single email messages longer than 64K. (This arcane limitation includes mailing headers, so be sure that your text is no larger than 60K in size.) Splitting a file offers another benefit as well. If a file transmission error occurs, you will only need to resend the segment of the file that was corrupted, not the entire file.
You can manually split a file into multiple parts using a text editor, or automatically using a text-splitting program. Some uuencoders will automatically split their output into multiple parts and will store each in a separate file. A third alternative is to use a utility such as the UNIX "split" program.
If you are emailing large graphics files, then you should uuencode and split them before sending them. A uuencoded file split into 950-line parts results in files that are 60K or less in size--just perfect for email. You can use the following commands to uuencode and split in two steps:
uuencode toshi.jpg toshi.jpg > toshi.uue split -950 toshi.uue toshi.
or in one step using a pipe:
uuencode toshi.jpg toshi.jpg | split -950 - toshi.
In both cases, the split program will store the uuencoded output into 950-line files named toshi.aa, toshi.ab, toshi.ac, and so on. Each of these files is then emailed separately, with the part numbers in the mail header "Subject:" lines.
Copyright © 1996, 1994 O'Reilly & Associates, Inc. All Rights Reserved.