You can use the vi text editor to compose messages while you run mailx. vi enables you to correct mistakes and add and delete text before you send your messages. If you are not already familiar with using vi, refer to Chapter 6, Using the vi Editor for instructions.
In the mailx program, you can use the standard vi commands for inserting, deleting, and changing text.
To write a message with vi:
Type the mailx command with an address at either the mailx prompt (&) or the command prompt ($).
Type the subject at the Subject: line. Press Return.
The vi screen appears, representing an empty file in your /tmp directory.
Use vi commands to type and edit the body of your message.
When you are finished, quit vi with the command :wq or ZZ.