Document revision date: 15 July 2002
[Compaq] [Go to the documentation home page] [How to order documentation] [Help on this site] [How to contact us]
[OpenVMS documentation]

OpenVMS User's Manual

Previous Contents Index

7.6.3 Creating Files from Messages

To create a text file from a message, enter the EXTRACT command and the file name at the MAIL> prompt while you are reading the message. When you exit from Mail, the file is listed in your current directory (unless you specify another directory). If the file is a DDIF file, Mail preserves the OpenVMS RMS file tags and DDIF semantics (VAX/VMS Version 5.2-2 or later).

The mail header is composed of the From:, To:, and Subj: lines. To create a file that does not include header information, specify the /NOHEADER qualifier to the EXTRACT command. If the message has more than one header (for example, a forwarded message), only the topmost header is deleted.

Use the /APPEND qualifier to the EXTRACT command to copy a message to the end of an existing file. Use the /ALL qualifier to copy all the files in the current folder to an existing file.

In the following example, a file named DEC_MEETINGS.TXT is created from the mail message shown:

#1                  01-DEC-1999  14:12:27        NEWMAIL 
To:    Thompson 
Subj:  Dates for December sales meetings 
Sales meetings in December will be held on the following dates: 
      Wednesday Dec. 8, 1999 
      Tuesday   Dec. 14, 1999 
      Monday    Dec. 20, 1999 
      Thursday  Dec. 30, 1999

The following example shows how to create a file named JANUARY_MEETINGS.TXT containing the text of message number 3:


7.6.4 Appending Files to Messages

To append a small file to the end of a mail message automatically, use the SET SIGNATURE_FILE command. The file you specify is automatically (by default) appended to every mail message you send using the ANSWER, FORWARD, MAIL, REPLY, or SEND command. An example of a signature file is a text file that is formatted as a business card, containing the user's company name, address, telephone number, and Internet address.

If you want to selectively append a file to a message or override the default signature file setting, use the /SIGNATURE_FILE[=file-name] qualifier with the ANSWER, FORWARD, MAIL, REPLY, or SEND command.

Use the SHOW SIGNATURE_FILE command to show whether you specified a default signature file. (The SHOW ALL command also displays signature file information.)

You can also set the default signature file at the DCL level by using the /SIGNATURE_FILE[=file-name] qualifier with the DCL command MAIL.

Note that when you create a mail message that includes a signature file, that message requires more temporary disk space than a conventional message because temporary files are created during the operation. After the message is sent, those temporary files are deleted.

When specifying the signature file name, also note the following:

In the following example, the file BUSINESS_CARD.SIG is designated as the default file that will automatically be appended to every mail message sent using the FORWARD, MAIL, REPLY, or SEND command.


In the next example, the file GREETINGS.SIG is designated as the file that will automatically be appended to that specific reply instead of the default signature file.


7.7 Other Ways to Send Messages

The following sections describe other ways to use the Mail utility to send messages.

7.7.1 Replying to Messages

To reply to a message you have received, use the following procedure:
Step Task
1 Type REPLY at the MAIL> prompt and press Enter.
2 Enter your message and press Ctrl/Z to send the message or press Ctrl/C to quit.

In the following example, a reply is being sent to STONE::THOMPSON. Note that after the reply command is entered, Mail automatically displays the To: and Subj: prompts:

Subj:  RE: Budget Meeting 
Enter your message below. Press CTRL/Z when complete. CTRL/C to quit: Replying to an Address Containing Nested Quotation Marks

In most cases, you can use the Mail command REPLY to reply to mail received from an address containing nested quotation marks. However, if your system does not have this capability, contact your system manager.

7.7.2 Forwarding Messages

To forward a mail message to other users, enter the FORWARD command at the MAIL> prompt after you have read the message. Mail prompts you for the name of the addressee and a subject line. After you enter the requested information, press Enter to send the message.

If you forward a message that consists of a .DDIF file, Mail sends the entire .DDIF file, including .DDIF semantics and the .DDIF tag, to the addressee.

In the following example, a message is forwarded to user STONE::JONES:

Subj: FYI -  Status of proposed budget meeting SET FORWARD Command

You can use the SET FORWARD command to redirect all mail messages sent to you to another account on another OpenVMS cluster or on another system entirely. Essentially this command creates an electronic forwarding address. Only set a forwarding address for accounts you do not want to check regularly. For example, you'd like to forward all your mail from your mail account on the OLD cluster to your mail account on the STAR cluster. After you log into OLD, enter the Mail utility and enter the following command:


All messages sent OLD::SMITH will be automatically redirected to the mail account on node STAR. You can also set your forwarding address to an Internet mail address:


In this case, all mail sent to OLD::SMITH will be sent to

Always send a test message to the old account to confirm that the account is forwarding correctly. To avoid creating forwarding loops where mail messages forward infinitely and never arrive, never set an account to forward to itself or another forwarding account. Do not forward OLD::SMITH to OLD::SMITH. Do not forward OLD::SMITH to STAR::SMITH and then forward STAR::SMITH to OLD::SMITH.

To check where an account is forwarding, enter the following command:

Your mail is being forwarded to STAR::SMITH. 

To remove a forwarding address, enter the following command:

You have not set a forwarding address. 

Confirm that you have removed the forwarding address and send the account a test message.


In prior versions of the OpenVMS operating system, you had to specify an extra pair of quotation marks if you wanted them included with the SET FORWARD command because the command automatically removed the first pair. Starting with OpenVMS Version 7.0, you need not specify an extra pair of quotation marks because the SET FORWARD command no longer removes the first pair.

7.8 Organizing Messages

The following sections describe how to organize mail messages.

7.8.1 Creating Folders

To organize your mail messages, you can create your own mail files and folders. A mail file contains folders, and a folder contains mail messages. Each folder and file can contain any number of messages.

Typically, you organize your messages by creating folders rather than by creating mail files. As with the default mail folders (NEWMAIL, MAIL, WASTEBASKET), the folders you create are normally stored in the mail file MAIL.MAI. The name of the current folder is displayed in the top right corner of the screen each time you enter a READ or DIRECTORY command. You can work only with messages that are in your current folder.

If your mail file is very large (over 500 blocks), you might want to create separate mail files for the larger folders to improve Mail's performance.

7.8.2 Creating Mail Subdirectories

When you receive mail messages, they are written to files named MAIL$xxxxxxxxxx.MAI by default and are located in your top-level directory. (Note that the x characters represent a long, random file specification.) Your default mail file, MAIL.MAI, is created in your top-level directory the first time you receive a mail message.

To avoid the display of .MAI files in your top-level directory, use the Mail command SET MAIL_DIRECTORY. This command creates a mail subdirectory and moves all your .MAI files to that subdirectory. To move the .MAI files from a subdirectory back to your top level directory, use the SET NOMAIL_DIRECTORY command.

To display the name of the subdirectory that contains all your .MAI files, enter SHOW MAIL_DIRECTORY at the MAIL> prompt.

In the following example, a user (FRED) creates the directory .MAIL:

Your mail file directory is SY$LOGIN:[FRED.MAIL]

7.8.3 Moving Messages into Folders

You can use either the FILE command or the MOVE command to place the current message in a different folder. If the folder does not exist, Mail displays a message asking if you want to create it. After filing the message in the specified folder, Mail automatically deletes the message from the current folder.

7.8.4 Copying Messages Between Folders

The Mail command COPY places a copy of the current message into the folder you specify. If the folder does not exist, Mail displays a message asking if you want to create it.

In the following example, all messages containing the word MEETING are copied from the current folder to a folder named SCHEDULE. After the COPY command completes, there are two copies of each message, one in the current folder and one in the folder named SCHEDULE.

Folder SCHEDULE does not exist. 
Do you want to create it (Y/N, default is N)?Y  

The following command selects and displays the next message containing the word "meeting":


%MAIL-E-NOTFOUND, no messages containing 'MEETING' found

7.8.5 Selecting Folders

To display a list of the folders in your current mail file, enter the DIRECTORY/FOLDER command. To select a new folder as your current folder, use one of the following commands:

In the following example, the MEMOS folder is selected:

Listing of folders in SYS$LOGIN:[FRED]MAIL.MAI;1 
     Press CTRL/C to cancel listing 
MAIL                                  MEETING_MINUTES 
MEMOS                                 PROJECT_NOTES 

7.8.6 Deleting Folders

To delete a mail folder, delete all the messages in the folder or move them to another folder. When you delete all messages in a folder, the empty folder is deleted automatically as soon as you select another folder.

In the following example, the messages in the MUSIC folder are deleted:

%MAIL-I-SELECTED, 2 messages selected

7.8.7 Creating and Accessing Mail Files

You can also create files to organize your mail messages. You use the same commands to create a mail file that you use to create a folder: COPY, MOVE, and FILE. After Mail prompts you for the name of the folder, it also prompts you for a file name. If you enter a new file name at the File: prompt, a new mail file is created.

To work within a mail file other than the default mail file, use the Mail command SET FILE to specify the alternate file. The Mail command SHOW FILE displays the name of the current mail file. When you change mail files, the WASTEBASKET folder of the current mail file is emptied and deleted (if AUTO_PURGE is set) and the mail file is closed.

Figure 7-1 shows how a typical user might organize their mail.

Figure 7-1 Organizing Mail

In the following example, the current message is moved into a folder named FEED in the ACCOUNTS file. The MOVE command creates the mail file ACCOUNTS.MAI, moves the current message into the FEED folder, and deletes the message from its current folder and file.

_Folder:  FEED 

In the following example, the FEED folder (which is in the ACCOUNTS file) is selected:

Your current mail file is SYS$LOGIN:[FRED.MAI]ACCOUNTS.MAI;1.

7.8.8 Correcting the Mail Message Count

If the number of new (unread) mail messages displayed on your screen is inconsistent with the actual number of new messages, enter the READ/NEW command when there is no new mail. You will know there is no new mail when you enter the READ/NEW command and receive one of the following system messages:

"%MAIL-W-NONEWMAIL, no new messages" 
"%MAIL-E-NOMOREMSG, no more messages" 

7.9 Deleting Messages

To delete a mail message from the current folder, either enter the DELETE command while you are reading the message or enter the DELETE command followed by the number (or range of numbers) of the message you want to delete. You can use either the hyphen (-) or the colon (:) to define the range of messages to be deleted.

In the following example, messages 4, 5, 6, 11, 12, 14, 15, 16, and 17 are deleted:

MAIL> DELETE 4-6,11,12,14:17 

7.9.1 Recovering Deleted Messages

When you delete a message, the message is moved to a folder called WASTEBASKET. Deleted messages collect in the WASTEBASKET folder until you exit from the current mail file (either by exiting from Mail or by specifying a different mail file). If you have issued the SET AUTO_PURGE command, when you exit from the current mail file, WASTEBASKET is emptied and the folder itself is deleted. During your interactive Mail session, you can recover any deleted message by moving the message out of the wastebasket folder. You can also empty the WASTEBASKET folder by entering the PURGE command.

In the following example, the mail message identified by the number 12 is deleted and then recovered from the WASTEBASKET folder.

%MAIL-I-SELECTED, 1 message selected 
    # top 
From                 Date         Subject 
    1 FABLES::WEST         11-DEC-1999  Meeting this week 

7.10 Printing Mail Messages

To print a mail message, enter the PRINT command at the MAIL> prompt. By default, Mail sends your message to the SYS$PRINT queue. Mail files are not sent to a print queue until you press Ctrl/Z, enter the EXIT command, or enter the PRINT/PRINT command.

To specify a different queue, use the PRINT command qualifier /QUEUE. You can also select a different queue by issuing the SET QUEUE queue-name command; this queue will remain your default print queue until you enter another SET QUEUE command, even if you exit Mail.

In the following example, the mail message is submitted to the AK34$PRINT print queue:


In the following example, the default print queue is changed from SYS$PRINT to AK34$PRINT:


7.11 Protecting Mail Files

The following sections describe how to protect mail files.

7.11.1 Default Protection

Mail files (for example, MAIL.MAI) are protected so that no one else can read them and so that you cannot accidentally delete them. The protection code that Mail gives .MAI files is: (S:RW,O:RW,G:,W:). The system (including Mail itself) and the owner (you) can read and write to the file. The group and world are denied all access.

The Mail utility also has default file protection to discourage mail tampering. However, Mail is not completely secure from tampering. Anyone with sufficient privileges can change protection and access mail files.

7.11.2 Security Measures

Mail files are within your own directory, so you have the option of applying the file protection techniques for sensitive files described in Chapter 10. In addition:

7.12 Using Text Editors in Mail

The following sections describe how to use text editors in the Mail environment.

7.12.1 Using EVE

You can use a text editor to write a message before you send it. To do so, specify the /EDIT qualifier with the SEND command. After you respond to the To: and Subj: prompts, Mail invokes the text editor. Unless you have selected a different editor, Mail invokes the DECTPU-based EVE editor.

The [End of file] marker moves down as you enter text. For more information about the EVE editor, see Chapter 8. To send the message, press the Do key and enter the EXIT command. To cancel the send operation, press the Do key and enter the QUIT command.

In the following example, EVE is used to create a mail message:


[End of file] 
Buffer:  MAIN                     |  Write  | Insert | Forward   


Do not edit a .DDIF mail file because you will no longer be able to use the file as a .DDIF file. If you edit a .DDIF mail file, you can access only the text of the file.

7.12.2 Using /EDIT Qualifier Keywords

By specifying the /EDIT qualifier when you invoke Mail, you can use the editor for sending, replying, and forwarding during the ensuing mail session. You can also use keywords with the /EDIT qualifier to set the default for Mail.

To invoke the editor only when you are replying to a message, use the REPLY keyword with the MAIL/EDIT command. To invoke the editor and display the message to which you are replying, use the REPLY keyword with the =EXTRACT option. If you do not specify a keyword with /EDIT, the default is /EDIT=(SEND,REPLY).

To send or reply to a message, EXIT from the editor. To cancel a SEND or REPLY command, enter the QUIT command to exit from the editor.


In the following example, the editor will be invoked for every mail message that is sent or forwarded:


In the following example, the editor will be invoked for every message that is replied to:


In the following example, the editor will be invoked and the message to which you are replying will be included as text every time you reply to a message:


Previous Next Contents Index

  [Go to the documentation home page] [How to order documentation] [Help on this site] [How to contact us]  
  privacy and legal statement