Example: Archive Messages from a Group of Users

For some types of email correspondence, it is desirable to maintain an archive of all messages that originate from a specific address or group of addresses within a company. The following rule creates copies of all messages sent by a member of a designated list and sends them to the quarantine to be archived. (Note that this example assumes that you are using the default PureMessage Policy configuration.)

To archive messages from a group of users using the PureMessage Manager:

  1. First, create a list containing the email addresses for the group of users whose messages you want to archive:
    1. Click New beside Lists on the Policy tab sidebar. The Add List/Map page is displayed.
    2. From the Type drop-down list, select List.
    3. In the ID text box, enter lgl.
    4. In the Name text box, enter Legal.
    5. In the Description text box, enter Email addresses of Legal Department employees.
    6. From the Match Type list, select Exact.
    7. Click Save. You are prompted to add items to the list. Click here to display the Edit List page.
    8. Enter the desired email addresses in the Add Items text box, making sure that each entry appears on a separate line.
    9. Click Add. The email addresses are included under List Items.
  2. Next, create a policy that will archive messages from the group of users specified in the Legal list:
    1. Click Policy Rules on the Policy tab sidebar to display the current policy.
    2. Click Create beside Backups on the Policy tab sidebar. A backup of the current policy is created; a backup entry with the current date and time is displayed in the Backups section of the sidebar.
    3. On the Policy tab, click the Mail from internal hosts rule.

      This creates a new rule at the bottom of the Internal Hosts section of the PureMessage Policy.

      1. Configure the Test:
        1. Click add rule (beside Execute actions and rules). This creates a new rule at the bottom of the Internal Hosts section of the PureMessage Policy.
        2. Change the (New Rule) text to Archive Messages from Legal.
        3. From the Tests drop-down list, select Envelope from. Select Is a member of as the operator and Legal from the available lists.
      2. Configure the Action:
        1. Click add action. This creates the action configuration template.
        2. In the new Execute actions and rules drop-down list, select Copy the message to quarantine.
        3. In the text box on the right (Quarantine Reason), enter Legal Archive.
        4. In the second rules drop-down list, select Stop processing.
      3. Click Save.

      4. Click the Commit link to update the live policy script. PureMessage displays a message advising that the milter is running with a stale configuration. Do not restart the milter (so you can test the changes without making them live).
    4. Test New Policy: Because the milter has not been restarted, it is still using the original policy. Therefore, the new policy can be tested without making it "live".
      1. Click Test Current Policy on the Policy tab sidebar.
      2. In the Envelope from text box, type one of the email addresses added to the Legal list.
      3. In the message source text box, replace the default text with the text for the test message.
      4. Click Test. The test runs and the test results are displayed. Notice there are two resulting delivery actions, copy to quarantine and keep. In the Details window, notice that there is a POLICY RULE HIT entry for "Archive messages from legal" and a POLICY ACTION entry indicating that a copy of the message has been filed in the quarantine.
        Note By default, messages remain in the quarantine for seven days before PureMessage moves them to the /opt/pmx6/home/archive directory. Manually delete unwanted messages from this archive. While managing quarantined messages, however, be careful not to prematurely delete messages copied to the quarantine for the purpose of archiving.
    5. If satisfied with the new policy, click Restart now to restart the milter and make the new policy live. To restore the original policy, click the backup link, and select OK.

Policy Script

To archive messages from a group of users by manually editing the policy script:

if pmx_virus {
    # attr NAME=Allow unscannable messages to pass through
    if pmx_virus_cantscan {
    reject "One or more viruses were detected in the message.";
# attr NAME=Archive messages from Legal
elsif envelope :comparator "i;ascii-casemap" :all :memberof ["from"]
    pmx_file "Legal Archive";

See the Policy Script Tutorial for more information about modifying the policy script from the command line.