# Domain Specific Settings

Note: Most 'matching' settings take wild card lists as parameters, for example "fred*" will match "freddy" and "Fred@bob". And "1.2.*,2.3.*" will match 1.2.4.4 and 2.3.99.100.

### address - Virtual Domain IP

This is not a setting itself but part of the vdomain setting. The vdomain setting is like a section heading, it divides the configuration file into sections, the global section comes first followed by any number of domain sections or vdomain blocks.

The address part of the vdomain setting is the IP number of this virtual domain. You will also need to configure your operating system and network to respond to this IP address. Doing this for specific operating systems is described on this page in more detail.

### domain_name - Domain MX Record name

This is not a setting itself, but part of the vdomain setting. The vdomain setting is like a section heading it divides the configuration file into sections. The global section comes first followed by any number of domain sections or vdomain blocks.

This is the name of this virtual domain of the mail server. It is a domain name it accepts mail for. The mail server supports any number of virtual domains. See this page for a discussion on different types of virtual domains.

eg: if you are wanting to send mail to user@mydomain.com this setting should be "mydomain.com". But if you are wanting to send mail to user@mail.mydomain.com this setting should be "mail.mydomain.com"

This setting is seperate from your actual hostname of the system running your email server. These will often be the same but if they are not it is important that the url_host setting setting is set to correctly resolve your server. eg: You could have domain_name = mydomain.com and url_host = mail.mydomain.com if your mail server is separate from your web server and your main company web server is already hosted on mydomain.com.

### alias_file - Alias file

In addition each domain has it's own 'alias' file (domain.name/alias.dat). You can create alias files using the same syntax as used in UNIX systems /etc/aliases. The format is:

    username:   destination
    bob:            fred@domain.com
    joe:             joesmith

This file only exists for backward compatibility.

### admin_access_default - Default features granted to domain admins in this domain

This setting allows you to specify default access to certain SurgeMail features. It is specified in the same maner as the g_admin_access settings 'access' parameter. eg:

admin_access_default "all,!users,!reports"

### centipaid - see centipaid.htm

Specifies accounts that can charge for incoming email.

### create_block - Block new users from this IP

Stops users from specific IP addresses from registering in this domain (assuming that you have allowed users to register themselves). Use this to stop known spammers from re-registering on your system.

### create_user - Method for adding new users

Can be one of:

Value | Description
open | Anyone can create an account immediately providing name and password. Be sure to set create_max "3" to prevent spammers creating dozens of accounts.
email | Anyone can create an account providing existing email address.
manager | Manager approves account, user provides existing email address.
manager_new | Manager activates account, user proves name and password.
disabled | Users cannot signup, accounts are created by the Web Admin.

In 'open' mode users account are created instantly. In 'email' mode they recieve an email and use a link to create their account. In 'manager' mode the manager recieves an email and via a link sends the user an email which they use to create their account. In 'manager_new' mode the account is created disable and the manager receives an email with a link to activate the account.

### create_max - Maximum signups from one IP in a day

This setting stops spammers registering hundreds of accounts on your system before sending out a lot of spam. A setting of 2-3 is probably a good idea.

### create_subdomain - Allows users to create an account that belongs to it's own unique domain.

If true this allows users to create accounts with a unique subdomain i.e. firstname@lastname.domain. SurgeMail uses the domuser system to handle sub-doamin users. Wildcard MX records are required to ensure delivery to subdomain users.

### create_reqd - Required fields for new users

A comma separated list of field names. Allowable field names are the "field" value(s) of the g_authent_info setting.

For example, if your setting is:
name,phone
then when a new user is created they will be forced to fill in the name and phone fields in the registration form.

NOTE: A g_authent_info setting is required to make the field appear on the signup page, eg.

g_authent_info name="Phone" field="phone" access="user" default=""

the above setting causes a field for phone to appear on the signup page and in the user details page.

### create_repass - User enters password twice on creation

If true this will show a "Password Again" input in addition to the "Password" input on the user signup page. The user is required to type the password in twice and the passwords are compared to ensure they are identical.

### create_tpl_dir - Relative path to user create pages

The relative path from the web directory to the user creation and user self management pages, these pages are typically called na_*.htm and stored in the /web directory. If you want a different look and feel for a domain simply set this and copy the pages to a directory in /web then modify them.

For example, if your setting is:
otherdomain/

Then you would:
cd /surgemail/web
mkdir otherdomain
copy na_*.htm otherdomain
CD otherdomain
notepad na_login.htm

### disable_surgeplus - Disable SurgePlus Calendar and File Sharing client

Disable users from logging in using the SurgePlus Calendar and File Sharing client. See SurgePlus

### dmail_bin_path - Path for DMail bin files to automatically convert

Path for DMail style bin files to automatically convert. This allows you to import delivered but unpopped mail from DMail bin and mailbox files. While this is set a check is done whether this import needs to be done each time a user logs on. Any mail is converted on the fly and added to the users SurgeMail inbox.

### dmail_drop_path - Path for drop files to automatically convert

Path for DMail / sendmail style drop files to automatically convert. This allows you to import delivered but unpopped mail from standard drop files. While this is set a check is done whether a drop file needs to be imported each time a user logs on. Any mail is converted on the fly and added to the users SurgeMail inbox.

### dmail_drop_prefix - Whether prefix is used on dmail drop files

Prefix on dmail drop files for dmail_drop_path conversion.

### dmail_hash - Hashing scheme used by dmail_drop_path and dmail_bin_path

DMail style hashing scheme used by dmail_drop_path and dmail_bin_path.

### delete_user_after - Number of days an account can remain unread before it is deleted

DO NOT USE THIS SETTING IN A MIRROR/CLUSTER SETUP

Number of days an account can remain unread before it is deleted. This setting cannot be used on an authent_domain FALSE domain unless it has a prefix setting.

### expire_age - Expire undeleted mail older than specified age left in INBOX

Use this to trim messages that are left in the INBOX, this means messages that are unread and messages which are read but not moved to another folder. The deleted messages are replaced with a single message explaining which items have been deleted (with from, subject and date of each message deleted). You should define both age and size to enable expiration.

Currently expire ONLY affects 'newmail' ie: mail that is waiting to be read not mail stored in IMAP folders.

### expire_size - Expire undeleted mail larger than specified size (units=bytes)

Use this to trim messages that are not read by users. The deleted messages are replaced with a single message explaining which items have been deleted (with from, subject and date of each message deleted so that anything really important can be recovered). You should define both age and size to enable expiration.

### expire_rule - Expire rules for specific folders

These rules let you specify and expire rule for any folder. The folder match is not case sensitive

e.g. to delete all spam message over 30 days old and larger than 3k and to empty the trash can each day.

expire_rule folder="Spam" age="30" size="3k"
expire_rule folder="Trash" age="1"

You can use wild cards, e.g. Delete all messages over 90 days old larger than 10k unless in the new or archive* folders.

expire_rule folder="*,!new,!archive*" age="90" size="10k"

### fallback - Fallback Email address or account

Specifies a default account to deliver Email to. This is sent to a non existent account. If not defined the Email will be bounced. Setting fallback to "/dev/null" will drop messages (both UNIX and Windows).

### fallback_check - Fallback check

Check if user exists on fallback relay host before accepting it.

### fallback_relay - Fallback host to relay non existent accounts to

Specifies a default host to send messages to that are not found in the local user database. This allows you to transition between two mail systems, as new accounts are created the emails will be delivered to SurgeMail, and ones that don't exist will be sent on to the old system automatically. There are several options to make this work using servers that only accept mail if they can do a reverse lookup.

### footer_file - Footer file for plain text messages

Footer file for all plain text messages 'from' this domain based on from address.

### footer_html - Text footer file

Footer file for all HTML messages 'from' this domain based on from address.

### forward_illegal - Prevents users setting forward rules to certain addresses

Syntax: g_forward_illegal to="address" apply="user type "

This setting allows you to specify some addresses as being illegal for certain users. This stops users setting up forwarding rules to these addresses. They can still send mail to these addresses manually with their email client. These rules _ONLY_ apply to non local domains.

Some examples:

If you want to stop your users setting up forward rules that redirect to aol.com.
g_forward_illegal to="*@aol.com" apply="user"

If you want to stop your users setting a forward to all domains except aol.com
g_forward_illegal to="*,!*@aol.com" apply="user"

Stop domain admins sending to aol.com
g_forward_illegal to="*@aol.com" apply="domadmin"

Stop admins sending to netwinsite.com
g_forward_illegal to="*@netwinsite.com" apply="admin"

### host_alias - Alias name(s) for this virtual domain

When a user sends to 'bob@xx.your.domain.name' or 'bob@yy.your.domain.name' you need to have the alias host names 'xx.your.domain.name' etc, defined or the mail server will reject the message. Wild card's can be used for this setting. Example: host_alias "*.your.domain.name" This can also be used to accept mail directly to the servers ip address eg 'bob@123.4.5.'

### list_disable - Disables creation of mailing lists

When set to "TRUE" this disables mailing list creation for this domain.

### list_max - Maximum number of mailing lists for this domain

Set this to the maximum number of mailing lists to allow for this domain.

### list_max_users - Maximum number of users allowed in all lists in this domain

This is a quota of users/members for all lists in this domain. The maximum number of members in each list in this domain must total to less or equal to this setting.

eg:
list_max_users "100"
list_max "2"

In this scenario, 100 users could be used in 2 lists. So one list might have 80 users the other 20, but the combined total must be less than or equal to 100 users.

### loginfails - Disconnect after failed logins

Disconnect user after this many bad password guesses.

### lookup_relay_on_from - Lookup from addresses for relay allowed

Looks up local authenticated smtp from addresses to check for relay is allowed flag (relay="true").

### manager_email - Managers Email

This is the manager's Email address for this domain. When users register themselves, if you have set create_user to the 'manager' method, an Email will be sent to this Email address to await confirmation of the user creation.

### mailbox_path - Path to mailbox maildir (inbox) files

Specifies the root directory for users in this domain for their incoming mail messages and mail folders (for IMAP), maildir structure is used and hashing will also be applied so if you specify d:\spool, then 'bob's Email will appear in d:\spool\xx\yy\bob\mdir... where 'xx' and 'yy' are hashing numbers for that user. (Hashing is required to keep directory performance at a high level when you have millions of users).

### msg_max_in - Max size of incoming messages for this domain.

Sets the size of messages for this domain, note that this may affect the ehlo response but only for 'address' based virtual domains, so you must ensure your g_msg_max setting is sufficiently large. Also since this figure may be shown before the msg_max_out value is determined you must also make it larger than the msg_max_out value. We don't recommend using this setting unless it is totally necessary. It is better to choose a g_msg_max setting that all domains can live with.

### msg_max_out - Max size of outgoing messages for smtp authenticated users

Sets the size of messages for this domain, as the email client may have already seen the value of g_msg_max or msg_max_in it may not help setting this value 'larger' than those other values. We do not recommend using this setting, it is best to choose a g_msg_max value that all domains can live with.

### old_pophost - Old pop host for pop intercept mode based migration

Specifies an old POP host that can be used when migrating users from an old mailserver to a new mailserver. This will create a local accounts with a identical username/passwords and retrieve all mail from the old server for the old account when the user logs into SurgeMail for the first time and they are not yet in the SurgeMail user database. Mail on the old server is deleted.

The use of old_pophost adds an additional check (based on partial rcpt delivery - see g_badfrom_check) to user account self creation to prevent user creating accounts that clash with existing accounts that have not been popped on SurgeMail. This means that the old server should only accept delivery to actual accounts or all user account self creation will be disabled.

### old_pophost_always - Always attempt to suck mail on each login

Suck mail from old_pophost on each login (account information is not set at each login). This allows the user to be using the new mail server and still retrieve mail from the old server if mail is delivered there. This is useful in two cases:
1) if the user is already using SurgeMail but some mail is still delivered to the old server due to delays in MX record propagation.
2) To allow incremental migration. Some users can be using the SurgeMail and some users can be using the old server. Users still on the old server sending mail to users on SurgeMail would deliver to the old server. When a user on SurgeMail logs into SurgeMail any such mail is retrieved from the old server.

Note: This will obviously stop retrieving mail if the user changes their password in SurgeMail but not on the old server.

### old_pophost_createuser_disable - Disable user creation in database on login

If you have already got your user in your authentication database and do not wish to setup this setting can be used to prevent user creation upon first login to SurgeMail using POP.

### old_pophost_nodomain - Strip domain when logging in to old_pophost

This can be used if you are migrating from a server that uses username only (without domain) logins.

### old_pophost_nodelete - Leave mail on the old server

This setting will leave mail on the old server just in case there are problems with the migration. Note: the use of this setting will disable the use of old_pophost_always.

### old_pophost_sep - Login separator

Seperater, default is '@'. e.g. some systems use %

Note: The old_pophost_iffirst and old_pophost_makeuser have now been replaced by the more consistent old_pophost_createuser_disable setting.

### old_imaphost - Intercept mode migration for IMAP folders servers

The old_pophost settings will create a local account and download many mail in your inbox. However in the event that your old server also was an IMAP server you will be able to migrate your stored message folders using the old_imaphost setting. This download is only ever attempted once and does so asynchronously. A 300MB mailbox with 15000 messages will would be expected to take around 20 minutes. While IMAP folders are bing downloaded the mailbox can already be used. Note: the mail on the old server gets deleted.

Upon IMAP login an old_pophost check is also performed if defined. This is specifically so that WebMail accessing SurgeMail using IMAP (recommended configuration) will allow the retrieval of mail from old POP servers.

### old_imaphost_always - Always attempt to suck mail on each IMAP login (slow)

This setting will force the download of mail and folders from the old server upon each IMAP login. Note: that this should only be used if specifically required as this will happen for example each time that a WebMail change made.

Note: This will obviously stop retrieving mail if the user changes their password in SurgeMail but not on the old server.

### old_imaphost_createuser_disable - Disable user creation in database on login

If you have already got your users in your authentication database and do not wish to add new users logging in using intercept mode this setting can be used to prevent user creation upon first login to SurgeMail using POP.

###

### old_imaphost_file, old_imaphost_user, old_imaphost_pass - Migration based on file settings

Specialist fileIMAP migration based on file settings.

### old_imaphost_lowercase - Lowercase all migrated folders

Lowercase all migrated folders.

### old_imaphost_nodomain - Strip domain when logging in to old_imaphost

This can be used if you are migrating from a server that uses username only (without domain) logins.

### old_imaphost_nodelete - Leave mail on the old server

This setting will leave mail on the old server just in case there are problems with the migration. Note: the use of this setting will disable the use of old_imaphost_always.

### old_imaphost_prefix - Mail prefix for old imap server when using old_imaphost

IMAP prefix for old imap server. eg. mail/.

### old_imaphost_skip - Skip folders

Comma seperate wild card list of migrate folders to skip past.

### old_smtphost - Old smtp host

SMTP host to check for existing users (when creating new accounts).

### old_smtphost_skip - Skip old_smtphost checks for administrators

Who to skip old_smtphost checks for. Valid values are "admin" and "domadmin".

### pop_welcome - Welcome message for POP/IMAP

This is the string displayed to the user when they connect to this domain before they login. The same string is also used in IMAP response. See also smtp_welcome.

### prefix - Prefix for usernames in database

This prefix is used in the user database to distinguish these virtual domain users. This setting is for backward compatibility and not generally recommended. It is better to store user@domain.name in the userdatabase rather than just 'username'.

### proxy_pop_nodomain - Strip domain when talking to proxy POP host

This setting causes the domain name to be stripped from user login names when talking to the proxy POP host. This does not apply to surgewall, see surgewall_options for details

### quota_default - Default Email quota for users

This setting allows you to limit disk usage of each user a setting of 10mb is typical. The main reason for this setting is to stop a single user who is being mail bombed using up all your disk space. So even if you don't want to limit disk use you should still set some limit eg:100,000,000 (100mb)

### redirect - Redirect Email to another account

This redirects mail from one user to another. The destination can be a full Email address with another domain name.

### redirect_cc - CC & Redirect Email to another account

This carbon copy redirects a message so the original user receives it as well as the new user you have specified. This is good for keeping a record of incoming emails for a particular account.

### smtp_welcome - Welcome message for SMTP

This is the string displayed to the user when they connect to this domain, before they login. See also pop_welcome

### spam_strip - Strip spam headers for this domain

Strip spamdetect headers for this domain.

### SurgeWall - Surgewall mailproxy feature (Version 1.4a or greater required)

This allows SurgeMail to be placed as a "filter" in front of an existing mailserver to apply friends rules, spam filtering and/or virus scanning. All you need to do is set this to the existing server address. POP3 will be routed through to the existing server and users can login to the SurgeMail web interface to configure their friends, spam and virus options eg:

surgewall "1.2.3.4"

This setting should be an IP address not an IP and port. Use surgewall_options if you need to specify non-standard ports or a different IP for POP, SMTP and/or IMAP. You may specify a comma seperated list of IP addresses. SurgeWall will connect to each in turn until it gets a successful login. To modify this behaviour see the proxy_failover option of the surgewall_options setting.

See here for more details.

### surgewall_options - SurgeWall miscellaneous options (Version 1.4c or greater required)

This setting controls the SurgeWall miscellaneous configuration options it has several parameters:

strip_domain | TRUE/FALSE strips the domain name from the username when sending to the original server.
proxy_failover | TRUE/FALSE failover mode for several addresses, only use next address if previous one fails to respond.
auth_local | TRUE/FALSE requires that users exist locally, no authentication is done via the original server.
pop | Comma seperated list of IP addresses and port of the original POP3 server.
imap | Comma seperated list of IP addresses and port of the original IMAP server.
smtp | Comma seperated list of IP addresses and port of the original SMTP server.
usercgi | pop/imap which protocol to use when authenticating logins to the web interface.

The POP, SMTP and IMAP options allow you to configure SurgeWall to connect to different IPs and/or ports for each interface that it proxies. So for example you can run SurgeWall on the same machine as the old mail server provided the old mail server is configured to run on non-standard ports. eg:

surgewall_options strip_domain="TRUE" pop="127.0.0.1:111" smtp="127.0.0.1:26" imap="127.0.0.1:144"

or perhaps you have the pop, smtp and imap components of the server running on several machines, eg.

surgewall_options strip_domain="TRUE" pop="1.2.3.4:111" smtp="2.3.4.5:26" imap="3.4.5.6:144"

You may specify several different IPs in a comma seperated list in the POP, SMTP and IMAP options if you do this SurgeWall will connect to each in turn until it gets a successful login. The same is true for the SurgeWall setting.

To modify this behaviour you can set proxy_failover to TRUE this causes SurgeWall to only use the next address if it fails to connect to the preceeding address, meaning it will use each server specified only if the previous server is not responding.

### url_alias - Allows translation from one URL to another

Allows translation from one URL or beginning of a URL to another. eg:

url_alias from="/cgi-bin/" to="/scripts/"

will cause the URL http://localhost:7025/cgi-bin/fred.cgi to reference the same file as http://localhost:7025/scripts/fred.cgi would have, the fred.cgi in the SurgeMail 'scripts' directory. These settings are checked before the g_url_alias settings, the first matching rule is used, settings are checked in the order specified.

### url_host - Mail host A Record name (if different from MX Record name)

This name is used in URLs to this domain. It is important that the hostname specified here will resolve to this physical host running SurgeMail at all times.

It is used by WebMail in the email sent to user upon signup. The email sent to the manager when a user signs up and is the host passed to WebMail when auto-logging a user in. If your auto-logins are failing because of a "cannot connect error" then you may need to set this to the correct host.

### user_access_default - Default user features granted to users in this domain

This setting allows you to specify default access to certain SurgeMail features. It is specified in the same maner as the g_user_access settings 'access' parameter. eg:

user_access_default "all,!spam,!virus"

### user_send_max - Maximum number of emails per day (requires SMTP AUTH)

This setting specifies the maximum number of messages an account in this domain is allowed to send in a day.

### user_alias - Number of aliases accounts can create

This setting specifies the maximum number of account aliases an account in this domain is allowed to create. The format of these aliases is specified in the file specified by the g_user_alias_file setting.

Default is disabled (0) which disables the alias creation interface in the user.cgi pages.

### user_centipaid - see CentiPaid.htm

Specifies the various CentiPaid options a user is allowed to configure for themselves.

### user_max - Maximum user allowed in this domain

This setting specifies the maximum number of users in this domain. Domain admins and users are blocked from adding more users than specified in this setting. The admin can still add users.

### user_list_quota - Number of mailing lists users can create

This setting configures the number of mailing lists a user of this domain can create. See also g_user_list_quota which can set quota globally or by user group. Also the list_quota authent field can set quota per user.

### user_sms - Enable users to setup SMS notifications

This setting allows users to setup an SMS notification of email whose subject matches the user defined keyword.

### user_sms_quota - Number of sms messages per account

This setting allows you to configure either a quota or a 'number of credits' system for SMS messages. This setting has 2 parameters 'initial' and 'period'.

If you set 'period' to 0 then 'initial' is the number of credits a user will begin with they are decremented when they send an SMS and not increased unless you increase them manually.

If you set 'period' to any value other than 0, then 'initial' is the users quota, which is re-set after the time period specified by 'period'. Valid 'period' values are a number of hours, or suffix the value with d, w or y to indicate a number of days, weeks or years respectively, eg: 5w equals 5 weeks.

### web_path - Path to web admin pages

Path to web admin and user self management pages. This setting allows you to give each domain a different set of pages and thus a different look and feel. To enable this, copy the entire 'web' directory then set web_path to the path of the copied files. Lastly modify the copied files to have the new look and feel you desire.

### webmail_host - The IP address of the mail server

SurgeMail sets the imaphost/smtphost address in surgehost.ini for WebMail. First it checks for a virtual domain ip, then it checks for a specifically bound ip address in the imap/smtp port settings, if neither are specified it defaults to 127.0.0.1. The webmail_host will override this process and assign a value directly. You require this when using a Smart Router or Load Balancer, please read this.

###