Message Processing

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.


Message Store

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.


Message Store Directory 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:

Folder icon users\

Collective directory for all user mailboxes.

Folder icon user_name\

A unique directory for each user's mailbox.

File icon inbox.box

The file containing all messages in the user's InBox (text and attachments). New messages are appended to the end of the file.

File icon inbox.idx

The index of all messages in the inbox.box file.

File icon main.cal

The Main calendar store. This file contains calendar items such as tasks, appointments, and notes in the user's Main calendar.

File icon main.idc

The index of all items in the main.cal file.

File icon calendar_name.cal

The calendar store for any calendar other than the Main calendar. This file contains calendar items, such as tasks, appointments, and notes for the designated calendar.

File icon calendar_name.idc

The index of all items in the calendar_name.cal file.

File icon folder_name.box

A unique file for each folder in the user's mailbox. It contains the folder's messages (text and attachments). New messages are appended to the end of the file.

File icon folder_name.idx

The index of all messages in the folder_name.box file.

Folder icon folder_name\

A unique directory for each folder that contains subfolders.

More disk space is required to maintain directories on the messaging server than to maintain files. Consequently, subfolders are very "expensive" in terms of server resources.

File icon subfolder_name.box

A unique file for each subfolder in the parent folder. It contains the subfolder's messages (text and attachments). New messages are appended to the end of the file.

File icon subfolder_name.idx

The index of all messages in the subfolder_name.box file.

Folder icon shares\

A directory containing index files for the shared folders and calendars to which the current user has subscribed.

folder icon owner\

A unique directory for each owner of the shared folders and calendars to which the current user has subscribed.

File icon shared_folder_name.sdx

The index of all messages in a shared folder to which the current user has subscribed.

File icon shared_calendar_name.sdc

The index of all items in a shared calendar to which the current user has subscribed.


Single Copy Message Store

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.


Single Copy Message Store Directory 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:

Folder icon scms\

Single Copy Message Store (SCMS) directory.

Folder icon 0-9, a-f

Sorting directories. Messages are sorted in these directories by the last hash value in the SCMS filename.

File icon xxxx

File with hashed filename (xxxx represents a hashed value) containing the multi-recipient message and any attachments.

File icon xxxx.cnt

Counter file. Its value is the total number of recipients. As each recipient deletes the message, the counter file decrements by 1. When its value is 0, the message and counter files are deleted.


Message Queue

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.


Message Queue Directory Structure

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/


Message Processing in the Message Queue

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.

 File iconxxxxxxxx.000

Queue 0: the prep queue. NMAP makes sure the control file meets all processing requirements and the AntiVirus Agent scans the data file.

File icon xxxxxxxx.001

Queue 1: The message is processed by the AntiSpam Agent and/or the List Agent.

File icon xxxxxxxx.002

Queue 2: The message is processed by the Alias Agent and/or the AutoReply Agent.

File icon xxxxxxxx.003

Queue 3: The message is processed by the Rule Agent.

File icon xxxxxxxx.004

Queue 4: This queue is not currently used by NetMail agents; it can be used by a third-party or custom agent.

File icon xxxxxxxx.005

Queue 5: The message is processed by the Calendar Agent.

File icon xxxxxxxx.006

Queue 6: The SMTP Agent uses its list of Global and Hosting domains to flag recipients as local and remote.

Messages addressed to recipients within the messaging system are delivered by the NMAP Agent.

Messages addres to remote recipients are processed by the Pluspack Agent.

File icon xxxxxxxx.007

Queue 7: Messages addressed to recipients outside the messaging system are picked up for delivery by the SMTP Agent.

File icon xxxxxxxx.008

Queue 8: 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.

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.


Message Processing: Step-by-Step Process

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 object icon

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 icon

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 icon

Proxy Agent

Modular Web Agent icon

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 icon

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 icon

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 icon

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 icon

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 icon

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 icon

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 icon

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 icon

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 icon

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 icon

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 icon

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 icon

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 icon

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 icon

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:

  • It generates a copy of the message.
  • It adds the local recipients to the new message and flags them as local recipients.
  • It removes the local recipients from the original message's control file.
  • It sends the new message to queue 0 for processing in the message queue.

NMAP Agent icon

NMAP Agent

After the SMTP Agent processes the message, the NMAP Agent performs one of the following actions:

  • If any of the recipients are local users, the NMAP Agent delivers a copy of the message to the local recipients' mailboxes. See Message Store Directory Structure.
  • If any of the recipients are local users and the message exceeds the Single Copy Message Store (SCMS) threshold, the message is copied to the SCMS directory and a pointer is sent to the local recipients' mailboxes. See Single Copy Message Store.
  • If some of the local recipients are not in the current NMAP Agent's context but are within the Directory tree, the NMAP Agent transfers the message to the NMAP Agents assigned to the users' contexts.
  • If the message has any remote recipients, the NMAP Agent leaves the message for processing by the Pluspack Agent.

Pluspack Agent icon

Pluspack Agent

The Pluspack Agent performs the following functions on all messages addressed to remote recipients:

  • If the Signatures option is enabled in the Pluspack Agent, the agent appends the system signature to all outbound messages.
  • If Message Copy is enabled in the Pluspack Agent, the agent sends a copy of all outbound messages to a designated recipient.
  • If Remote Sending is enabled in the Pluspack Agent, the agent verifies the message sender is allowed to send remote messages. If the message sender is not allowed to send remote messages, the message is deleted from the message queue. Depending on how the Pluspack Agent is configured, it might return a message to the sender indicating he or she is not allowed to send remote messages.

For more information on the Pluspack configuration, see Pluspack Agent.

NMAP Agent icon

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 icon

SMTP Agent

In queue 7, the SMTP Agent picks up the message for remote delivery across the Internet.

Queue 8

NMAP Agent icon

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.


Message Processing Performance

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.