close
Mailspect Documentation
Archive and Spam Quarantine Management

Contents

About This Guide

This is a manual that explains the important concepts and details of MPP Manager. You will not find every option documented as options are added and revised frequently, but you will find lots of useful information to help understand the MPP Manager platform and its components.

MPP Manager Overview

MPP Manager has three main components – mppserver, qReview and MPP GUI. Mppserver is the web server that MPP Manager is built on and qReview and MPP GUI are applications. This guide explains MPP Server and the applications that it supports. Some concepts such as users, domains and authentication permeate all applications while others are endemic to their applications.

Other Documentation

This guide should be used in conjunction with the MPP Installation Guide.

Mppserver - MPP Manager Web Server

Overview

MPP Manager includes an integrated web server for fast and easy installation of the MPP Manager Platform. MPP Manager configuration files are in /etc/mppserver/mppserver.conf. Though most all of the configuration options may be changed from the GUI it is necessary to manipulate the configuration file manually for some settings.

Installing MPP Manager

There is one integrated installation for all components and applications of MPP Manager.

Mppserver is the MPP Manager web server and it is installed as a component of MPP Manager. See the installation guide for more detail, however, installation is generally a single command run from the mppmanager directory in /usr/local/MPP/www directory, setup.pl. To execute seupt.pl run ./setup.pl in the mppserver directory.

The setup script will prompt you for information such as enabling SSL, changing the default application port and other options.

After setup is complete qReview will be available with any standard web browser on port 20000 and the MPP GUI is available on port 20001.

Controlling mppserver

Mppserver has control scripts in /usr/local/MPP/mppserver/bin. The scripts are installed in the correct locations during installation and will mppserver will automatically start when the OS is booted. The following commands are for times when it is necessary to manually control mppserver.

Start /usr/local/mppserver/bin/start
Stop /usr/local/mppserver/bin/stop
Restart /usr/local/mppserver/bin/restart

Debugging MPP Server

Mppserver has log files in /usr/local/mppserver/logs and log level can be raised in /etc/mppserver/mppserver.conf. For verbose logging set app_log in /etc/mppserver/modules.conf and restart mppserver.

app_log - /usr/local/mppmanager/logs/debug.txt

Changing MPP Server Ports

MPP Server listens on port 20000 for spam quarantine and archive management and port 20001 for the MPP configuration GUI. To change these ports edit /etc/mppserver/mppserver.conf and change two locations:

port - 20000
port - 20001
virtual_host - 20000:qreview:/usr/local/mppserver/apps/quarantine/wwwdocs
virtual_host - 20001:mpp-gui:/usr/local/mppserver/apps/mpp-gui/wwwdocs

Updating MPP Manager

There are frequent updates to the MPP Manager suite and it is advisable to check our FTP servers or mailing list regularly for updates. When updating MPP Server all of the information in /etc/mppserver is maintained and will not be overwritten. This includes user and domain configurations, server settings and more.

If you have changed our www templates then you should back them up prior to updating.

To update mppserver simply download the latest from ftp://ftp.messagepartners.com/pub/mppmanager/mppmanager.tar.gz , unpack and run the setup script, setup.pl. The script will automatically stop and start mppserver and add any new options the configuration files.

Customizing MPP Manager Application Templates

MPP Manager applications are template drive and can be edited and translated. Be careful to back up your changes or they will be overwritten in an upgrade.

MPP GUI Templates

It is not recommend to customize these templates, however, templates may be found in usr/local/mppserver/apps/mpp-gui/templates. Customization of MPP GUI should only be attempted by experienced HTML programmers.

qReview Templates

It is more common to customize qReview templates and these may be found in /usr/local/mppserver/apps/quarantine/templates/www.

Translating MPP Manager Applications

MPP Manager applications are template driven and can be entirely translated. Besides translation you can change the wording of any help message, dialog or field label in our translation files. If you create a translation of any application please submit it to us and we will add it to our distribution.

Translating qReview

This is the most common customization of MPP Manager. QReview translation files may be found in /usr/local/mppserver/apps/quarantine/templates/translate and /usr/local/mppserver/apps/quarantine/templates/tooltips/en. To create a new translation copy the en directory and translate the strings as desired. The format of your translation file must be in UTF-8 and we can assist in format conversion if necessary.

Translating MPP GUI

Translation of MPP GUI requires translating help screens as well as application prompts, fields and dialogs. Files can be found in /usr/local/mppserver/apps/mpp-gui/wwwdocs/lang and tool tips can be found in /usr/local/mppserver/apps/mpp-gui/wwwdocs/tooltips.

MPP Server Administration Guide

Setup Menu

The setup menu is only available to global administrators. This section will describe functions and concepts that permeate MPP Manager while setup options related to quarantine and archive applications will be covered in subsequent chapters.

Setup Information

The information screen shows how many active users are on the system, when they last logged in and other vital statistics. There is a drop down filter to see users based on their digest subscription status.

Domains

At least one domain must be defined and it is highly recommended to define a default domain. When you define a domain you are enabling per-domain searches and defining authentication properties for your installation. Different domains may have different authentication properties.
It is not necessary to define all domains, especially if you have many domains that authenticate to the same authentication server. However, it is useful to define domains if you want to easily see all quarantined messages for a domain.
Adding a Domain List
It is possible to enter a list of domains in the add list text box. Paste a list of domains, 1 per line, and define the authentication parameters. All domains will use the same authentication parameters as defined.
Default Domain
A default domain provides authentication properties of last resort and also will serve as the default domain part of a login. For example if a user mike logs in and no user is defined named mike then mike will be authenticated with the properties of the default domain.
The default domain is useful if you have many domains that authenticate to the same pop3 server. This way all you need to define is one domain and then all other domains will authenticate using the default domain authentication method.
Another good use of the default domain is if you have a single domain, your authentication server requires a full email address and your users are not used to typing in their full email address for authentication. In this case MPP Manager can automatically append the domain name to the login userid.
Authentication
MPP Manager supports POP3, IMAP and PASSWORD File authentication. Authentication can be set on a per-domain basis. Since there are many variances in
You have the option to send complete email addresses or just username parts to the authentication server. For example if a user logs in with mike@raemail.net you can decide to send mike or mike@raemaill.net to your POP3 server. If a user enters mike and there is a default domain defined then the default domain will be appended to the user name. However, if the default domain is configured to only send the username then the domain will not be appended and user will be authenticated using the properties of the default domain.
POP3 Authentication
With POP3 authentication a user will login with their normal pop3 userid and password and MPP Manager will authenticate with the POP3 server defined in the domain definition. You have the option to send the complete email address or just the user part.
If a user logs in with a domain other than the default
IMAP Authentication
MPP Manager can authenticate to any standard IMAP server. The same conventions apply to imap as described in POP3.
PASSWD Authentication
PASSWD authentication will authenticate users against a standard password file that is internal to qReview. The advantage to this method of authentication is that you can create arbitrary use names and passwords that have are independent of a domains user directory. In practice it can become difficult to deal with all of the idiosyncrasies of a subscriber directory out of your control and the passwd method allows a

Understanding MPP Manager Users and Aliases

It is important to understand the concept of a MPP Manager user and when it is required to create them. It is not necessary to create MPP Manager users for most cases since MPP Manager will authenticate against an existing directory and will scan the quarantine to see if there are messages for the user. However there are times when a users login id differs from their email address or the user needs special rights or other cases where you must create a user in MPP Manager.

Cases Where Users Should Be Defined

This is not a complete list of cases but will give some ideas when it will be necessary to create users in MPP Manager.
Login ID’s differ from Email Accounts
Problems arise when a users login id is different than their email address as is frequently the case with Active Directory. In this case a user will login with their email address and it will fail since there is no valid login for the email address. For example, if mike Is my Active Directory account, while my email address and mikempp@messagepartners.com, if I login with mikempp@messagepartners.com this will fail, since Active Directory is looking for mike as the login. Furthermore, if I login with mike then I won’t see any quarantined messages for mikempp@messagepartners.com until I create an alias for this address.
In future versions of MPP Manager we will support Active Directory logins, but even without AD, this case arises with IMAP and POP user databases.
User Requires Administrative Rights
If a user requires administrative rights they must always be added as a user in MPP Manager.
PASSWD Authentication
There are many times when it is not possible to authenticate against a user store or where it is necessary to create new passwords for specific users of a domain. While it is possible to create one password for an entire domain and avoid creating users this is not a general practice.

Administrator and User Roles

This section describes the roles of end-users and administrators.

End User

An enduser can access stored email and settings for themselves and their aliases. An end-user can appoint a quarantine supervisor who can access their stored messages.

Global Administrators

Global Administrators have full rights on the message store.

Domain Quarantine Administrator

Domain Administrators have full administrative rights over the domains defined in the permissions field. Enter a comma-separated list of domains that the administrator is allowed to control.

User Supervisors

User Supervisors are allowed to view the quarantines of other users defined in their permissions. Users may define their own supervisors for ease of admins

Aliases

MPP Manager can read aliases from our own MySQL database, text files or any arbitrary MySQL database. A user that logs in will see their spam or email archives for all aliases defined here.

To define a MySQL source for aliases define the MySQL host and database then define the field name for actual user and field name for aliases. When a user logs in MPP will check this table to display spam or archives for the email address and associated aliases. Both domain and individual aliases are supported. Individual aliases can be in the same or different domains as the user.

You may also statically define aliases that will be stored in the MPP user file in /etc/mppserver. Simply enter the email address and associated aliases and save.

NOTE: that aliases may be defined on the digest page are expressly for spam digest reports. Aliases defined here apply to both digests and quarantine/archive display lists.

Module Configuration Parameters

The module configuration parameter page lists all variables that are available for configuration. Most of these variables can be set in other GUI screens and others can be set in /etc/mppserver/modules.conf

apps_dir  	               Location of primary mppserver directory
mppd_conf 	               Location of MPP configuration file
delete_after_days 	       Used for spam delete script, delete spam older than x days
deletion_delay_seconds        Used for spam delete script, amount of time to wait between delete 
                              sets
deletion_set_size 	       Used for spam delete script, amount of records to delete per set
delete_empty_dirs 	       Used for spam delete script, specifies whether to delete empty
                              directories when file quarantine is in use.
remove_meta 	               Used for spam delete script, controls deletion of .info files, aka
                              metadata
auth_ttl 	               Controls how long to cache a valid login
quarantine_source 	       Generally read automatically from mppd.conf.xml, must be defined if
                              digests and MySQL are deployed
archive_source 	               Generally read automatically from mppd.conf.xml, may be manually 
                              defined as needed
smart_refresh_period 	       Time period between automatic screen refreshes
qreview_url 	               Used for spam digests, URL that users are instructed to visit for 
                              spam quarantines
qreminder_last_login_before   Used for spam digests, only send digests to users that have logged
                              in since x days.
qreminder_delay_seconds       Used for spam digests, time to wait between reminder sets
qreminder_send_set_size       Used for spam digests, number of users to send reminders to per set
qreminder_how_to_send         Used for spam digests, controls SMTP server to use
qreminder_templates_dir       Used for spam digests, email template directory
qreminder_tpl_from            Used for spam digests, sender of digests
qreminder_tpl_subject         Used for spam digests, subject of reminder email
qreminder_tpl_body_html       Used for spam digests, html of digest reminder
qreminder_tpl_body_text       Used for spam digests, text of digest reminders
timezone                      Timezone
qreview_confdir 	       Location of configuration files for qReview
mpp_gui_confdir 	       Location of configuration files for MPP GUI
quarantine_source_read        Used for replication environments, location of MySQL slave
quarantine_source_write       Used for replication environments, location of MySQL master
archive_source_read 	       Used for replication environments, location of MySQL slave
archive_source_write 	       Used for replication environments, location of MySQL master
spam_action_source 	       Generally read from mppd.conf.xml, where spam actions are stored – 
                              a file, or mysql uri
wbl_source 	               Generally read from mppd.conf.xml, where WBL’s are stored – a file, 
                              or mysql uri
qreminder_msg_to_show 	       Used for spam digests, how many messages to display in digest 
                              reminder
arch_delete_enabled 	       Controls if archive deletion is enabled
arch_ga_can_del 	       Controls if global admins can delete from archives
arch_qa_can_del 	       Controls is quarantine admins can delete from archives
arch_eu_can_del 	       Controls if end users can delete from archives
arch_delete_after_days        Used for archive purge script, delete email older than x days
arch_import_enabled 	       Controls if IMAP import is enabled
arch_ga_can_imp 	       Controls if global admins can import IMAP email
arch_qa_can_imp 	       Controls if quarantine admins can import IMAP email
arch_eu_can_imp 	       Controls if end users can import IMAP email
max_archive_size 	       Used for archive quota script, the maximum allowed size of archive 
                              per domain
max_archive_size_threshold    Used for archive quota script, percentage of max archive size when
                              warnings are sent
alerts_email 	               Used for archive quota script, address to send quota alerts to
sphinx_dir 	               Location of Sphinx main director
app_log 	               Location of debug log, if enabled
qreminder_send_if_no_spam     Used for spam digests script, controls if users with no spam should 
                              receive digest reminders
magic_location	         The presence of the correct magic value will cause a message to not 
                            be processed by MPP.  The magic is added to a message when it is released 
                            from quarantine.   Be default magic is read from /var/run, however, in the 
                            case where magic is stored in a database, or it is necessary to use the 
                            magic value of another MPP instance it may be desirable to set where the 
                            magic value is read from.

SSL

MPP Server supports SSL using standard certificates. Certificates can be uploaded from MPP –GUI in the System tab or can be manually copied to the mppserver directory.

Selecting Language

MPP supports multiple languages and each application supports its own language options. To select language in Module Config in both qReview and MPP Manager.

Spam Quarantine Administration

Quarantine Purge

There are two components to quarantine purge. Set the age of messages to purge, deletion set size and delay interval between sets in the Maintenance menu. Execute a manual quarantine purge in Spam menu using the clear option.

Digest Reports

Digest reports are controlled in the Maintenance menu. All templates may be customized here and scheduling options can be set. Please back up your customizations of digests before upgrading MPP Manager.

Digest reports are only available if MySQL quarantine is enabled.

Things To Set If You Want Digests

  • Set the ‘from’ information of the digest report
  • Set the quarantine location manually
  • Check who is subscribed for digest and manually subscribe users who require digests.

Who Receives Digests

Digests are sent to users who have spam have logged and their aliases at least once and within the interval defined in qreminder_last_login_before from Setup->Module Config. If you want users without spam to receive digests then set qreminder_send_if_no_spam to 1 in Setup-> Module Config.

Who Does NOT Receive Digests

Users who have never logged in do not receive digests by default nor do users with no new spam. Both of these options can be overridden.
Subscribing Users to Digests
To subscribe users to digest reports go to Maintenance->Digests and select ‘Subscribe All Users’.
Subscribing Users that Have No Entry in Users Table
If users are not present in the MPP Manager user tables, have never logged in and require digests then there are two options. The first option is to manually add the users and their aliases in the digests page, the second is to scan the MPP quarantine users table (different from MPP Manager users) and add users from this table as MPP Manager users with the option labeled ‘Check For
Unsubscribed Users and Subscribe Them,’ also available in the digests screen.
This option is very dangerous if you do no check for valid recipients before storing spam. If you do not check for valid recipients then you will have many thousands of non-existent users and this feature will subscribe them all for digests.
Define User/Alias List to Subscribe
Use this option to define a list of users with comma-separated aliases. Define one user per line.

End User Options

White and Black Lists

Users may set white and black lists for themselves or for their domains if they are administrators. A whitelisted user will not be scanned for spam while a blacklisted user will be blocked from sending messages to you. In the nomenclature of MPP a contact is the address to be white or black listed and a user refers to the user of the MPP system making the request.
Direction always refers to the direction of the user.
If user user@company.com wants to Whitelist email from mike@raemail.net :
User=user@company.com, contact=mike@raemail.net, direction=recipient
If user@company.com wants to Whitelist all email that he sends to customer.com
User=user@company.com, contact=customer.com, direction=sender
If user@company.com wants to Whitelist all email from customer.com
User=user@company.com, contact=customer.com, direction=recipient

Spam Settings

Spam actions can be modified to the users preferences. For example, if a user would rather have all of their spam have email subject or header marks rather than quarantined they can set this on their own. The options are self-explanatory.

Profile Options

Profile options include setting language, adding aliases and adding supervisors who can manage your spam quarantine.

Aliases

Aliases are addresses that you use to represent yourself, such as sales@company.com. You should define the aliases that you use in the profile section in order to see spam sent to your aliases.

Clearing the Quarantine

You may clear the quarantine for you, your aliases and users that you have access to their quarantine. Clear the quarantine from spam->clear.

Saving Messages

Messages are saved as .msg file and multiple messages are saved as .mbox file. Msg files may be opened by any email client, however, mbox files can only be parsed by standard email clients such as Thunderbird or Eudora. Outlook can not import .mbox files without a special add-on. Look for improvements in this area shortly.

Releasing Messages

Messages can be released from quarantine using the ‘deliver’ option in the message dropdown. Messages that are delivered are not re-scanned as spam. You may forward messages using a remote SMTP server if you require this.

Forwarding Messages

Messages can be forwarded using the forward option from the message drop down window.

Searching the Quarantine

Quarantines can be searched by message subject and sender.

Searching by Subject

Subjects can be searched with the % character as wildcard. To search for success, search %success%. To search for success in the beginning of the subject use success%.
You can search a single character using the '_' character. So to find email with one D in the subject use _D%.
If you want to search for the characters % or _ then add an escape character before them. The escape character is \. So to search for 10% enclose 10\% in % signs or %10\%%

Searching Spam by Sender Address

Spam can be searched by sender address using pattern matching. Pattern matching allows you to use '_' to match any single character and '%' to match an arbitrary number of characters (including zero characters). To match exactly '%' or '_' characters escape them as '\%', '\_'. Pattern matching is case insensitive.
Examples
To find messages from mike@* use mike% pattern
To find messages from sender containing mike anywhere in email address use %mike% pattern
To find messages from example.com and its subdomains use %@%example.com pattern

Archive Administration

Administrator Options

This section builds on previous sections and presents features relevant to email archive. The same concepts of users, domains, authentication and mppserver options apply to archival. Not every option is documented as they change frequently, however, the main underlying concepts are presented to help you gain an understanding of what is available with MPP Manager.

Archive Purge

By default it is not possible to delete from the MPP archive, however, an administrator may choose to allow the functionality. Archive deletion can be enabled at the global, domain level admin and user level. Email that is deleted from the archive is also saved in an archive mbox on the archive server so even if a user attempts to erase an email there is still a copy that only a system level administrator could access.
Archive deletion is controlled under Maintenance -> Archive Purge

Archive Quota

Archive quotas are enforced on a per-domain basis, though currently one quota applies to all domains. MPP Manager will send a warning email to an administrator when the email archive nears its quota.
Archive quota is controlled under Maintenance -> Archive Purge

Import Options

Email archive import is an important capability of the MPP Archive solution. MPP can accept email into the archive from the following sources:
  • MPP installed on an email server or gateway
  • MS Exchange Journaled Email
  • Postfix bcc email
  • Other journal sources
  • IMAP Import
  • MIME File Import
IMAP Import
MPP Manager supports IMAP import under the Archive menu. IMAP import can be enabled or disabled at the global, domain admin and end-user levels. If enabled an administrator can import the email for one user or a list of users and can set aging criteria and connection characteristics.
File Import
File Import is not implemented under MPP Manager but is currently supported with a command line script. MPP can import MIME files with or without SMTP or CGP envelope information and mbox files.
File Import Script Usage
Latest version is at ftp://ftp.raeinternet.com/pub/mpp3/sql/mpp_archive_import.pl
Updates:
  • support SQL schema 3_3
  • automatically detect schema 3_2 or 3_3
  • import from maildir
  • import single message
Usage:./mpp_archive_import.pl [-f] -m mailbox -r recipient [-h hostname] [-d database] [-u user] [-p password]
m mailbox full path to mailbox
f add this flag to specify that mailbox is a single message
r recipient recipient mail address (usually owner of mailbox)
h hostname MySQL hostname
d database MySQL database
u user MySQL user
p password MySQL password
NOTE:
MySQL parameters are optional. They can be adjusted within the script:
# MySQL credentials
my $mpp_host="localhost";
my $mpp_user="root";
my $mpp_pass="";
my $mpp_db="mpp_archive";


Examples:
- create db with schema of choice, default and recommended 3_3
1) Import single message
./mpp_archive_import.pl -f -m /home/ovidiu/single_message.eml -r ovidiu@domain.com -h localhost -d mpp_archive -u root -p password
2) Import maildir
./mpp_archive_import.pl -m /home/ovidiu/Maildir -r ovidiu@domain.com -h localhost -d mpp_archive -u root -p password
3) Import mailbox
./mpp_archive_import.pl -m /home/ovidiu/Inbox -r ovidiu@domain.com -h localhost -d mpp_archive -u root -p password
4) Importing multiple messages (EML) from directory:
i.e. /home/ovidiu/dir for file in $(find /home/ovidiu/dir -type f); do ./mpp_archive_import.pl -f -m $file -r ovidiu@domain.com -h localhost -d mpp_archive -u root -p password; done

Searching Email Archives

Full Text Searching Disabled

Full Text Searching Enabled

QReview supports full-text searching of email subjects, message bodies, attachment names and text based attachment bodies using the Sphinx search engine. Sphinx is a very powerful open source indexing and search tool.
README.sphinx provides exact instructions for adding full text search abilities to MPP Email Archive.
MPP makes use of the powerful Sphinx indexing engine and provides the following documentation as a guide to searching the email archives. The following excerpts are taken directly from the Sphinx online documentation and reproduced for your convenience. RAE Internet does NOT copyright this material.
Search SyntSphinx supports 4 modes of searching
SPH_MATCH_ALL, matches all query words (default mode);
SPH_MATCH_ANY, matches any of the query words;
SPH_MATCH_PHRASE, matches query as a phrase, requiring perfect match;
SPH_MATCH_BOOLEAN, matches query as a boolean expression (see Section 4.2, “Boolean query syntax”);
SPH_MATCH_EXTENDED, matches query as an expression in Sphinx internal query language (see Section 4.3, “Extended

Boolean query syntax

Boolean queries allow the following special operators to be used:
  • explicit operator AND:
hello & world
  • operator OR:
hello | world
  • operator NOT:
hello -world
hello !world
  • grouping:
( hello world )
Here's an example query which uses all these operators:
Boolean query example
( cat -dog ) | ( cat -mouse)
There always is implicit AND operator, so "hello world" query actually means "hello & world"
OR operator precedence is higher than AND, so "looking for cat | dog | mouse" means "looking for ( cat | dog | mouse )" and not "(looking for cat) | dog | mouse".
Queries like "-dog", which implicitly include all documents from the collection, can not be evaluated. This is both for technical and performance reasons. Technically, Sphinx does not always keep a list of all IDs. Performance-wise, when the collection is huge (ie. 10-100M documents), evaluating such queries could take very long.

Extended query syntax

Extended queries allow the following special operators to be used:
  • operator OR:
hello | world
  • operator NOT:
hello -world
hello !world
  • field search operator:
@title hello @body world
  • phrase search operator:
"hello world"
  • proximity search operator
"hello world"~10
Here's an example query which uses all these operators:
"hello world" @title "example program"~5 @body python -(php|perl)
There always is implicit AND operator, so "hello world" means that both "hello" and "world" must be present in matching document.
OR operator precedence is higher than AND, so "looking for cat | dog | mouse" means "looking for ( cat | dog | mouse )" and not "(looking for cat) | dog | mouse".
Proximity distance is specified in words, adjusted for word count, and applies to all words within quotes. For instance, "cat dog mouse"~5 query means that there must be less than 8-word span which contains all 3 words, ie. "CAT aaa bbb ccc DOG eee fff MOUSE" document will not match this query, because this span is exactly 8 words long.
Nested brackets, as in queries like
aaa | ( bbb ccc | ( ddd eee ) )
are not allowed yet, but this will be fixed.
Negation (ie. operator NOT) is only allowed on top level and not within brackets (ie. groups). This isn't going to change, because supporting nested negations would make phrase ranking implementation way too complicated.

Weighting

Specific weighting function (currently) depends on the search mode.
There are these major parts which are used in the weighting functions:
  1. phrase rank,
  2. statistical rank.
Phrase rank is based on a length of longest common subsequence (LCS) of search words between document body and query phrase. So if there's a perfect phrase match in some document then its phrase rank would be the highest possible, and equal to query words count.
Statistical rank is based on classic BM25 function which only takes word frequencies into account. If the word is rare in the whole database (ie. low frequency over document collection) or mentioned a lot in specific document (ie. high frequency over matching document), it receives more weight. Final BM25 weight is a floating point number between 0 and 1.
In all modes, per-field weighted phrase ranks are computed as a product of LCS multiplied by per-field weight speficifed by user. Per-field weights are integer, default to 1, and can not be set lower than 1.
In SPH_MATCH_BOOLEAN mode, no weighting is performed at all, every match weight is set to 1.
In SPH_MATCH_ALL and SPH_MATCH_PHRASE modes, final weight is a sum of weighted phrase ranks.
In SPH_MATCH_ANY mode, the idea is essentially the same, but it also adds a count of matching words in each field. Before that, weighted phrase ranks are additionally mutliplied by a value big enough to guarantee that higher phrase rank in any field will make the match ranked higher, even if it's field weight is low.
In SPH_MATCH_EXTENDED mode, final weight is a sum of weighted phrase ranks and BM25 weight, multiplied by 1000 and rounded to integer.
This is going to be changed, so that MATCH_ALL and MATCH_ANY modes use BM25 weights as well. This would improve search results in those match spans where phrase ranks are equal; this is especially useful for 1-word queries.
The key idea (in all modes, besides boolean) is that better subphrase matches are ranked higher, and perfect matches are pulled to the top. Author's experience is that this phrase proximity based ranking provides noticeably better search quality than any statistical scheme alone (such as BM25, which is commonly used in other search engines).