HP OpenVMS Systems Documentation
OpenVMS User's Manual
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:
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
To reply to a message you have received, use the following procedure:
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:
188.8.131.52 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.
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:
184.108.40.206 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 SMITH@Company.com.
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:
To remove a forwarding address, enter the following command:
7.8 Organizing Messages
The following sections describe how to organize mail messages.
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
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:
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.
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.
The following command selects and displays the next message containing the word "meeting":
7.8.5 Selecting Folders
In the following example, the MEMOS folder is selected:
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:
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.
In the following example, the FEED folder (which is in the ACCOUNTS file) is selected:
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:
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:
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.
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.
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
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
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:
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: