Indiana University
University Information Technology Services
  
What are archived documents?

In Elm or Berkeley mail, how do I send a file?

Note: Elm is not available on any UITS systems.

To send a file in Elm or Berkeley mail, your file must be an ASCII file. If you wish to send a binary file, you must uuencode it first. For step by step instructions, see In Unix, how do I uuencode a binary file? Also, the Pine mailer has a distinct procedure for sending files. See In Pine, how do I attach a file to an email message? for details.

You have two options for sending files. You can send the file at the Unix prompt, or you can send a file while you are reading your mail.

Sending files from the Unix prompt

Whether you are using Elm or Berkeley mail, the procedure is the same: you need to redirect mail so that a file is used for input instead of the keyboard.

For Berkeley mail, at the Unix shell prompt, enter: mailx -s "subject" username@address < myfile For Elm, enter: elm -s "subject" username@address < myfile Replace subject with the subject line you want for the message; replace username@address with the intended recipient's email address; and replace myfile with the name of the file you wish to send.

The -s option instructs the mailer to use the text preceding the mail address as the subject of the message. Be sure to enclose the subject in quotes if it contains more than one word. The subject information may be omitted, but the recipient will then have no description of the contents of the message. For example, the following format is also valid: elm user@machine < myfile Note: Be careful to use < and not >. If you use a >, the output of mail will be redirected to the file, and the file will be over-written.

If you don't want to run the risk of getting > and < confused, you may choose to use the following command instead: cat myfile | mailx -s "subject" username@address or: cat myfile | elm -s "subject" username@address This redirects the output of cat to the input of mail, producing the same effect as the previous examples.

Sending files when reading your mail

You always have the option of including a mail message using the editor within Berkeley mail or Elm. First, go through the normal procedure you take to send a message, so that you are in an editor and ready to compose a message. The steps you then take depend on the type of editor you are using.

To include a file when you are using Emacs to compose a message, press Ctrl-x, then press i, and enter the name of the file you wish to include.

In Pico, to include a file, press Ctrl-r and enter the name of the file you wish to include.

In vi, to include a file, enter ex mode (press :) and then enter: r filename Replace filename with the name of the file you wish to include.

At Indiana University, to get support for personal or departmental Linux or Unix systems, see At IU, how do I get support for Linux or Unix?

Also see:

This is document acee in domain all.
Last modified on August 22, 2008.
Please tell us, did you find the answer to your question?