ppoossttmmaapp --qq ""_s_t_r_i_n_g"" rreeggeexxpp:://eettcc//ppoossttffiixx//_f_i_l_e_n_a_m_e
ppoossttmmaapp --qq -- rreeggeexxpp:://eettcc//ppoossttffiixx//_f_i_l_e_n_a_m_e <_i_n_p_u_t_f_i_l_e
Alternatively, lookup tables can be specified in POSIX regular expression form. In this case, each input is compared against a list of patterns. When a match is found, the corresponding result is returned and the search is terminated.
To find out what types of lookup tables your Postfix system supports use the "ppoossttccoonnff --mm" command.
To test lookup tables, use the "ppoossttmmaapp --qq" command as described in the SYNOPSIS above.
With Postfix version 2.2 and earlier specify "ppoossttmmaapp --ffqq" to query a table that contains case sensitive patterns. Patterns are case insensitive by default.
The general form of a Postfix regular expression table is:
Each pattern is a POSIX regular expression enclosed by a pair of delimiters. The regular expression syntax is documented in rree__ffoorrmmaatt(7) with 4.4BSD, in rreeggeexx(5) with Solaris, and in rreeggeexx(7) with Linux. Other systems may use other document names.
The expression delimiter can be any non-alphanumerical character, except whitespace or characters that have special meaning (traditionally the forward slash is used). The regular expression can contain whitespace.
By default, matching is case-insensitive, and newlines are not treated as special characters. The behavior is controlled by flags, which are toggled by appending one or more of the following characters after the pattern:
Patterns are applied in the order as specified in the table, until a pattern is found that matches the input string.
Each pattern is applied to the entire input string. Depending on the application, that string is an entire client hostname, an entire client IP address, or an entire mail address. Thus, no parent domain or parent network search is done, and _u_s_e_r_@_d_o_m_a_i_n mail addresses are not broken up into their _u_s_e_r and _d_o_m_a_i_n constituent parts, nor is _u_s_e_r_+_f_o_o broken up into _u_s_e_r and _f_o_o.
Substitution of substrings from the matched expression into the result string is possible using $1, $2, etc.; specify $$ to produce a $ character as output. The macros in the result string may need to be written as ${n} or $(n) if they aren't followed by whitespace.
Note: since negated patterns (those preceded by !!) return a result when the expression does not match, substitutions are not available for negated patterns.
# Disallow sender-specified routing. This is a must if you relay mail # for other domains. /[%!@].*[%!@]/ 550 Sender-specified routing rejected
# Postmaster is OK, that way they can talk to us about how to fix # their problem. /^postmaster@/ OK
# Protect your outgoing majordomo exploders if !/^owner-/ /^(.*)-outgoing@(.*)$/ 550 Use ${1}@${2} instead endif
# These were once common in junk mail. /^Subject: make money fast/ REJECT /^To: friend@public\.com/ REJECT
# First skip over base 64 encoded text to save CPU cycles. ~^[[:alnum:]+/]{60,}$~ OK
# Put your own body patterns here.
postmap(1), Postfix lookup table manager pcre_table(5), format of PCRE tables cidr_table(5), format of CIDR tables
Use "ppoossttccoonnff rreeaaddmmee__ddiirreeccttoorryy" or "ppoossttccoonnff hhttmmll__ddiirreeccttoorryy" to locate this information.
DATABASE_README, Postfix lookup table overview
The regexp table lookup code was originally written by: LaMont Jones lamont@hp.com
That code was based on the PCRE dictionary contributed by: Andrew McNamara andrewm@connect.com.au connect.com.au Pty. Ltd. Level 3, 213 Miller St North Sydney, NSW, Australia
Adopted and adapted by: Wietse Venema IBM T.J. Watson Research P.O. Box 704 Yorktown Heights, NY 10598, USA