Rewrite general database substitutions

Rewrite general database substitutions, $(...)
A substitution of the form     is handled  specially. The   part is used as a key to access the MTA&#x27;s general database. If   is found in the database, then the corresponding  template from the database is substituted. If   does not match an entry in the database, then the  rewrite process fails; it is as if the rewrite rule never matched in  the first place. If the substitution is successful, then the template extracted from the database is re-scanned for additional substitutions. However, additional     substitutions from  the extracted template are prohibited in order to prevent endless  recursive references.

Depending upon the setting of the MTA option , the general "database" is either stored and  accessed as an on-disk database (formerly the default; now deprecated),  or as an in-memory  structure constructed (during configuration compilation or MTA  initialization) from an on-disk flat text file. Or new in MS 8.0, the general "database" can instead be stored in memcache; see the  MTA option. The on-disk database, if that is what is being used, is    (which formerly could be redirected via the now-deleted   MTA Tailor option), which must be generated using the    utility from some  site-supplied  source text file. If an in-memory database structure is instead being used, then when the MTA configuration is compiled (or at MTA process  initialization time, if a compiled configuration is not in use) the MTA  reads the    file (which formerly could be redirected via the now-deleted    MTA Tailor file option)  and compiles it  into an in-memory structure. Use of an in-memory "database" is normally recommended (for reasons of performance and reliability);  however, do note that use of this in-memory "database" does  require  recompiling the configuration  to get changes to the  "database" (changes to the source text file) incorporated  into the compiled configuration.

As an example, suppose that the address jdoe@host1.domain.privateuse matches the rewrite rule .privateuse    $($H) Then, the text string host1.domain will be looked up in the general database and the result of that look up, if any, instead used for the rewrite  rule&#x27;s template. Suppose that the result of looking up host1.domain is $u%mailhost.domain.com@tcp_intranet-daemon. Then the output of the template will be jdoe@mailhost.domain.com (i.e., username = jdoe, host/domain  specification = mailhost.domain.com), and the routing system will be    (the  typical official host name of the   channel).

If a general database exists it should be world readable to insure that it operates properly.

See also:
 * General database
 * use_text_databases MTA Option
 * general_database_url MTA Option
 * imta_general_database MTA Option
 * crdb utility
 * cnbuild utility
 * Typical TCPIP channels and servers
 * Rewrite rule template substitutions and control sequences