The core function of NetMail is message processing. Every message entering your messaging system---either inbound or outbound, from internal or external users---must be processed by NetMail agents. Depending on which agents are running on your messaging system, the message might be checked against a system blacklist, forwarded to another e-mail address, or filtered by user-defined rules.
The directory infrastructure that supports message processing comprises three basic components:
Everything that happens from the time a message enters the messaging system to when it is delivered to the user's mailbox occurs in these directories.
This section explains message processing both in terms of its directory infrastructure and the actual process. By understanding the internal structure of your NetMail system and how messages are processed, you can better manage your messaging system.
The message store is the directory structure that holds users' mailboxes and messages. All other information required by your NetMail system is stored in eDirectory. Every server running an NMAP Agent has a message store. You can manually create additional message stores using Container objects or NetMail Parent objects. See Creating Separate Message Stores for Each Domain.
For information on mailbox file structure, see Mailbox File Structure.
The default message store directories for each platform are as follows:
| Platform | Directory Structure |
|---|---|
NetWare |
sys:\novonyx\mail\users\ NOTE: Because NetWare requires free space on the sys: volume, consider the potential disk space requirements of your messaging system before creating the mail directories on the sys: volume of a NetWare server. For information on changing the location of the message store, see the Message Store property in Configuring the NMAP Agent . |
Windows* |
drive:\program files\novell\netmail\mail\users |
Linux |
/var/opt/novell/netmail/users/ |
The NMAP Agent creates the following mailbox directory structure within the message store directory for every User object in its assigned contexts:
In cases when a message is sent to multiple recipients (by default, five or more) and the message is larger than a given size (by default, over 5 KB), NMAP does not replicate the message in all the users' mailboxes. Instead, a pointer message is sent to the individual mailboxes directing NMAP to the complete message in the Single-Copy Message Store (SCMS) directory. When the last user downloads or deletes the message, it is deleted from the shared directory.
For more information, see SCMS Message Structure.
The default single copy message store directories for each platform are as follows:
| Platform | Directory Structure |
|---|---|
NetWare |
sys:\novonyx\mail\scms\ |
Windows |
drive:\program files\novell\netmail\mail\scms\ |
Linux |
/var/opt/novell/netmail/scms/ |
The SCMS directory structure stores messages in sorting directories that correspond to the last character in their hexadecimal filename (0-9 or A-F). Sorting messages by the last character in their hexadecimal filename allows the NMAP Agent to efficiently retrieve messages stored in the SCMS directories.
The SCMS directory structure is as follows:
Each message store has an associated message queue. The message queue is the directory where messages are processed as they enter or leave the NetMail messaging system.
For a complete discussion of how messages flow through the message queue, see Message Processing in the Message Queue.
The NMAP Agent is responsible for managing the message queue. When the NMAP Agent receives a message, it downloads the file to the message queue directory.
The default message queue directories for each platform are as follows:
| Platform | Directory Structure |
|---|---|
NetWare |
sys:\novonyx\mail\spool\ |
Windows |
drive:\program files\novell\netmail\mail\spool |
Linux |
/var/opt/novell/netmail/spool/ |
As the NMAP Agent downloads a message to the message queue directory, it generates two files: cxxxxxxx.in and dxxxxxxx.in. (The xxxxxxx represents a hashed value of the date and time the message was sent. The .in extension indicates the message is inbound.)
The cxxxxxxx.* file is the control file envelope. The control file is generated from information received in the initial SMTP exchange. It contains To and From information along with any message flags. All message processing functions are performed on the control file.
The dxxxxxxx.* file is the data file. It contains the message header and message text. Because most message processing is done through the control file, the data file is rarely opened.
NOTE: For a complete breakdown of control file content and data file format, see Message Structure.
After the message is downloaded, NMAP gives the data file a .msg extension and then begins moving the control file through eight queues. The process of moving the control file between queues is a simple matter of changing its filename extension to reflect the current queue number.
The following table outlines the message-processing functions associated with each queue.
When the NMAP Agent moves a message into a queue, it notifies the agent registered on that queue. (Agents register on their queues when they first load.) The registered agent then scans the control file and performs its assigned function. If the agent modifies the message, NMAP returns the message to queue 0 for reprocessing. If no changes are made, NMAP advances the message to the next queue.
The following table provides a detailed, step-by-step breakdown of NetMail message processing. The outlined process includes all NetMail queue agents; however, on live systems the process includes only those agents actually loaded on messaging servers and registered with the NMAP Agent.
| Agent | Description |
|---|---|
User |
Someone sends a message over the Internet to a user within your messaging system or one of its proxied accounts; or Someone within your messaging system sends a message. |
|
The message enters the message queue via the SMTP, Proxy, or Modular Web agents. |
SMTP Agent |
When the SMTP Agent receives a new message, it uses its list of Global and Hosting domains to flag the local and remote recipients. It then transfers the message to its assigned NMAP Agent (queue server). |
Proxy Agent
Modular Web Agent |
When the Proxy or Modular Web Agents receive a new message, they flag all recipients as remote and transfer the message to their assigned NMAP Agents (queue servers). |
NMAP Agent |
In downloading the message to the message queue directory, the NMAP Agent creates the message control file (cxxxxxxx.in) and data file (dxxxxxxx.in). The control file contains To and From information along with any message flags. The data file contains the complete message. See Message Structure for more information on the control file and data file. |
Queue 0 |
After the message is downloaded, the NMAP Agent gives the data file a .msg extension and moves the control file to queue 0 by changing the file extension from .in to .000. |
NMAP Agent |
In queue 0, the NMAP Agent verifies that the control file meets all processing requirements. It then notifies the AntiVirus Agent that it has a message to process. |
AntiVirus Agent |
The AntiVirus Agent then scans the data file for any attachments. Attachments are sent to a third-party virus engine to be scanned. If an attachment contains a virus, the message is deleted from the queue. Depending on how the AntiVirus Agent is configured, it might send a virus alert to the message recipient or return the message to the sender. The NMAP Agent then moves the control file to queue 1 by changing the file extension from .000 to .001 and notifies the AntiSpam and/or List Agents that they have a message to process. |
Queue 1 |
Queue 1 is shared by the AntiSpam Agent and the List Agent because it doesn't matter which of these agents processes the message first. |
AntiSpam Agent |
The AntiSpam Agent checks the control file to see if the sender is on its blackout list. If the sender is on the blackout list, the message is deleted from the queue. Depending on how the AntiSpam Agent is configured, it might return the message to the sender or send the postmaster a copy of the returned message. |
List Agent |
The List Agent checks the control file to see if the message is addressed to a mailing list. If it is, the List Agent generates a new message with the names of the individual users in the mailing list. The new message is returned to queue 0 and the original message is deleted. |
NMAP Agent |
If there are no changes, the NMAP Agent moves the file to queue 2 by changing the file extension from .001 to .002 and notifies the Alias and/or AutoReply Agents that they have a message to process. |
Queue 2 |
Queue 2 is shared by the Alias Agent and the AutoReply Agent because it doesn't matter which of these agents processes the message first. |
Alias Agent |
The Alias Agent checks the control file to see if the recipient matches any of its defined aliases. If so, the Alias Agent replaces the alias with its corresponding e-mail address. |
AutoReply Agent |
The AutoReply Agent checks the recipient's User object to see if the recipient has either configured an autoreply message or forwarded messages to another e-mail account. (The user's forward and autoreply information is stored in his or her User object.) If the recipient has forwarded his or her mail, the agent adds the forwarded address to the recipient list. If the recipient did not request a copy of the message, the agent replaces the recipient's name with the forwarded address. If the recipient has configured an autoreply message, the agent generates a new message and hands it off to NMAP for processing in the message queue. |
NMAP Agent |
If the original message has been modified, the NMAP Agent returns the message to queue 0 for reprocessing. If there are no changes, the NMAP Agent moves the file to queue 3 by changing the file extension from .002 to .003 and notifies the Rule Agent that it has a message to process. |
Queue 3
Rule Agent |
In queue 3, the Rule Agent checks the message against the recipient's defined rules. (Rules are stored in the user's User object.) If the message matches one of the rule conditions, the Rule Agent applies the rule. If a rule moves the message to a specific folder, the Rule Agent adds the destination folder information to the control file in IMAP format. Using the IMAP protocol to designate the destination folder enables the message to be routed to the correct folder in any standards-based e-mail client. |
NMAP Agent |
If the message has been modified, the NMAP Agent returns the message to queue 0 for reprocessing. If there are no changes, the NMAP Agent moves the file to queue 5 by changing the file extension from .003 to .005. |
| Queue 4 | Queue 4 is not currently used by NetMail agents although it can be used by third-party or custom agents. |
Queue 5
Calendar Agent |
In queue 5, the Calendar Agent checks to see if the message is an Accept, Delegate, or Decline reply to a scheduled appointment. If the message is a response to an appointment and if the person who scheduled the appointment is a local user, the Calendar Agent updates the user's calendar store (mail.cal) to indicate the sender accepted, delegated, or declined the appointment. |
NMAP Agent |
If the original message has been modified, the NMAP Agent returns the message to queue 0 for reprocessing. If there are no changes, the NMAP Agent moves the file to queue 6 by changing the file extension from .005 to .006 and notifies the SMTP and Pluspack Agents that they have a message to process. |
Queue 6 |
In queue 6, messages are processed by the SMTP, NMAP and Pluspack agents. |
SMTP Agent |
In queue 6, the SMTP Agent reviews the recipient list in the control file envelope. It uses its list of Global and Hosting domains to identify the local and remote recipients. If it finds any local recipients that are still flagged as remote recipients, it does the following:
|
NMAP Agent |
After the SMTP Agent processes the message, the NMAP Agent performs one of the following actions:
|
Pluspack Agent |
The Pluspack Agent performs the following functions on all messages addressed to remote recipients:
For more information on the Pluspack configuration, see Pluspack Agent. |
NMAP Agent |
If the original message has been modified, the NMAP Agent returns the message to queue 0 for reprocessing. If there are no changes, the NMAP Agent moves the file to queue 7 by changing the file extension from .006 to .007 and notifies the SMTP Agent that it has a message for remote delivery. |
Queue 7
SMTP Agent |
In queue 7, the SMTP Agent picks up the message for remote delivery across the Internet. |
Queue 8
NMAP Agent |
This queue is a holding queue for bounced messages. The NMAP Agent leaves bounced messages in queue 8 until it has time to reprocess them. |
NetMail processes messages very rapidly. The NMAP Agent is multi-threaded and can simultaneously process as many messages as memory will allow. To ensure optimal efficiency, NetMail automatically balances the NMAP Agent's thread usage with server utilization. When server resources are abundantly available, the NMAP Agent attempts to instantaneously fulfill all mail requests. However, when the mail load becomes heavy, NMAP tries to preserve server resources by limiting the number of threads that can be used for message delivery.
Under normal conditions, NMAP creates two threads to deliver every message; one to receive the message and one to push the received message through the queue. This state is called Concurrent Mode.
When the number of delivery threads exceeds the Concurrent Limit, new threads both receive messages and push them through the queue. This state is called Sequential Mode.
When the number of threads exceeds the Sequential Limit, new threads receive messages, but defer delivery until the total number of threads drops back below the Concurrent Limit. Only when NMAP drops back into Concurrent Mode will it deliver queued messages.
When the number of queued messages exceeds the NMAP Agent's load balancing settings, NMAP checks CPU utilization at a regular interval. If utilization exceeds the NMAP Agent's high threshold, NMAP lowers the Concurrent and Sequential Limits in an effort to lower utilization. If utilization drops below the NMAP Agent's low threshold, NMAP raises the Concurrent and Sequential Limits to make sure system resources are not wasted. The NMAP Agent's ability to self-adjust its load balancing settings ensures the NMAP Agent operates at optimal efficiency.
Magnifying the efficiency of the NMAP Agent, NetMail message processing is strategically designed to optimize performance. For example, separating each message into a control file and a data file speeds performance because most message processing is done using the small, compact control file. The larger data file is rarely opened.
The message queue itself is also designed for speed. Changing the control file's extension in a single directory rather than transferring the file between different queue directories makes advancing through the queue as efficient as possible.
Finally, having NMAP notify agents when a message is placed in their queues, rather than having the agents periodically scan their queues, means there is zero wait time between message-processing functions.