Mail Redirection - a guide

SurgeMail can redirect mail in one of four ways. These can be mixed but we suggest you pick one and use it as it can get very confusing:

  1. Global redirection and cc rules
  2. Per domain redirection and cc rules
  3. Per domain alias files (for backwards compatibility)
  4. Forward by returning new destination address from authent database

What is the difference?

  • Global redirection takes place as soon as the message arrives and is applied to local and non local addresses. Global redirection rules should use fully specified email addresses.

    g_redirect was="user1@fulldomain" to="user2@somedomain"

  • This is powerful but means you can unwittingly redirect outgoing mail. eg: redirection of postmaster@* -> admin@mydomain will redirect incoming mail for postmaster accounts on all local domains to admin@mydomain BUT will also redirect outgoing mail for postmaster@remotedomain to admin@mydomain!

  • Per Domain redirection will be applied once a local destination domain is identified and allows individual accounts on a domain to be redirected. The match rule should not include the domain name:
  • redirect was="user1" to="user or user@otherdomain"

  • Alias files for backward compatibility UNIX style alias files may be used to redirect mail for a certain accounts in a domain.
  • Fwd in Authent Database If your authentication lookup returns a "fwd=new@address" field then the mail will be redirected to this account. This is done just prior to message delivery and after full processing of the message. This is the setting which may be changed by users using the web based account administration.

What happens if I different redirection mechanisms together?

Redirects under the same category will all be applied at the same time and multiple rules may be applied. Also redirection may be to accounts which are in turn being redirected.

  1. Global redirection attempted. If g_redirect applied no further redirection is attempted (specifically this overrides #2 below)
    - g_redirect
    - g_redirect_cc


  2. Domain based redirection. If redirect or alias file is applied no further redirection is attempted (overrides #3)
    - redirect = domain redirect
    - alias file redirection
    - redirect_cc = per domain cc


  3. Authentication based fwd (overrides #4)

  4. Message delivered normally to local account.

Advanced use of redirection

Both local and global redirection allow * wildcard to be used in the "was" field and the %n wildcard to be used in the "to" field.

eg. *_*@domain -> %1@%2.domain

would allow joe_bloggs@domain to be redirected to joe@bloggs.domain

Gateways

The g_gateway setting is a final form of mail redirection that will will redirect mail for an entire domain (or subdomain) to a particular IP address.

Typically this other server is inside a fire wall so its local IP address is not known by the DNS server. You specify the domain and IP address (and optional login information) to send messages to and this server is treated as 'local' rather than remote in terms of open relay restrictions.