[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.3 Composing Mail

You can compose the message by simply typing the contents of it, line by line. But usually this is not enough, you would need to edit your text, to quote some messages, etc. Mail provides these capabilities through compose escapes. The compose escapes are single-character commands, preceded by special escape character, which defaults to `~'. The combination escape character + command is recognized as a compose escape only if it occurs at the beginning of a line. If the escape character must appear at the beginning of a line, enter it twice. The actual escape character may be changed by setting the value of escape mail variable (see section 3.4.6 How to Alter the Behavior of mail).

Quitting Compose Mode  
Getting Help on Compose Escapes: ~?  
Editing the Message: ~e and ~v  
Modifying the Headers: ~h, ~t, ~c, ~b, ~s  
Enclosing Another Message: ~m and ~M  
Adding a File to the Message: ~r and ~d  
Printing And Saving the Message  
Signing the Message: ~a and ~A  
Printing Another Message: ~f and ~F  
Inserting Value of a Mail Variable: ~i  
Executing Other Mail Commands: ~: and ~-  
Executing Shell Commands: ~! and ~|  

Quitting Compose Mode

There are several commands allowing you to quit the compose mode.

Typing the end-of-file character (`C-D') on a line alone finishes compose mode and sends the message to its destination. The `C-D' character looses its special meaning if ignoreeof mail variable is set.

If mail variable dot is set, typing dot (`.') on a line alone achieves the same effect as `C-D' above.

Finally, using `~.' escape always quits compose mode and sends out the composed message.

To abort composing of a message without sending it, type interrupt character (by default, `C-C') twice. This behavior is disabled when mail variable ignore is set. In this case, you can use `~x' escape to achieve the same effect.

Getting Help on Compose Escapes: ~?

The `~?' escape prints on screen a brief summary of the available compose escapes. Please note, that `~h' escape prompts for changing the header values, and does not give help.

Editing the Message: ~e and ~v

If you are not satisfied with the message as it is, you can edit it using a text editor specified either by EDITOR or by VISUAL environment variables. The `~e' uses the former, and `~v' uses the latter.

By default both escapes allow you to edit only the body of the message. However, if the editheaders variable is set, mail will load into the editor the complete text of the message with headers included, thus allowing you to change the headers as well.

Modifying the Headers: ~h, ~t, ~c, ~b, ~s

To add new addresses to the list of message recipients, use `~t' command, e.g.:

 
~t name1@domain.net name2

To add addresses to Cc or Bcc, use `~c' or `~b' escapes respectively.

To change the Subject header, use `~s' escape, e.g.:

 
~s "Re: your message"

Finally, to edit all headers, type `~h' escape. This will present you with the values of To, Cc, Bcc, and Subject headers allowing to edit them with normal text editing commands.

Enclosing Another Message: ~m and ~M

If you are sending mail from within mail command mode, you can enclose the contents of any message sent to you by using `~m' or `~M' commands. Typing `~m' alone will enclose the contents of the current message, typing `~m 12' will enclose the contents of message #12 and so on.

The `~m' uses retained and ignored lists when enclosing headers, the `~M' encloses all header fields.

In both cases, the contents of indentprefix mail variable is prepended to each line enclosed.

Adding a File to the Message: ~r and ~d

To append the contents of file filename to the message, type

 
~r filename
or

 
~< filename

The `~d' escape is a shorthand for

 
~r dead.letter

Printing And Saving the Message

The `~p' escape types the contents of the message entered so far, including headers, on your terminal. You can save the message to an arbitrary file using `~w' escape. It takes the filename as its argument.

Signing the Message: ~a and ~A

To save you the effort of typing your signature at the end of each message, you can use `~a' or `~A' escapes. If your signature occupies one line only, save it to the variable sign and use `~a' escape to insert it. Otherwise, if it is longer than one line, save it to a file, store the name of this file in the variable Sign, and use `~A' escape to insert it into the message.

Printing Another Message: ~f and ~F

Sometimes it is necessary to view the contents of another message, while composing. These two escapes allow it. Both take the message list as their argument. If they are used without argument, the contents of the current message is printed. The difference between `~f' and `~F' is that the former uses ignored and retained lists to select headers to be displayed, whereas the latter prints all headers.

Inserting Value of a Mail Variable: ~i

The `~i' escape enters the value of the named mail variable into the body of the message being composed.

Executing Other Mail Commands: ~: and ~-

You can execute a mail command from within compose mode using `~:' or `~-' escapes. For example, typing

 
~: from :t

will display the from lines of all tagged messages. Note, that executing mail-sending commands from within the compose mode is not allowed. An attempt to execute such a command will result in diagnostic message "Command not allowed in an escape sequence" being displayed. Also, when starting compose mode immediately from the shell (e.g. running `mail address@domain'), most mail commands are meaningless, since there is no mailbox to operate upon. In this case, the only commands that can reasonably be used are: alias, unalias, alternate, set, and unset.

Executing Shell Commands: ~! and ~|

The `~!' escape executes specified command and returns you to mail compose mode without altering your message. When used without arguments, it starts your login shell. The `~|' escape pipes the message composed so far through the given shell command and replaces the message with the output the command produced. If the command produced no output, mail assumes that something went wrong and retains the old contents of your message.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by Sergey Poznyakoff on December, 23 2004 using texi2html