On Wed, Jan 28, 2009 at 10:39 PM, Dave <d...@davestechshop.net> wrote:
>
>
> On Wed, Jan 28, 2009 at 10:30 PM, Aaron Wolfe <aawo...@gmail.com> wrote:
>>
>> On Wed, Jan 28, 2009 at 9:25 PM, Dave <d...@davestechshop.net> wrote:
>> >
>> >
>> > On Wed, Jan 28, 2009 at 9:18 PM, Victor Duchovni
>> > <victor.ducho...@morganstanley.com> wrote:
>> >>
>> >> On Wed, Jan 28, 2009 at 09:04:48PM -0500, Dave wrote:
>> >>
>> >> > > Google is full of noise. Try:
>> >> > >
>> >> > >    http://www.postfix.org/documentation.html
>> >> > >    http://www.postfix.org/ADDRESS_REWRITING_README.html
>> >> > >    http://www.postfix.org/ADDRESS_REWRITING_README.html#generic
>> >> > >    http://www.postfix.org/generic.5.html
>> >> > >    http://www.postfix.org/DATABASE_README.html#types
>> >> > >    http://www.postfix.org/pcre_table.5.html
>> >> > >    http://www.postfix.org/regexp_table.5.html
>> >> > >
>> >> > > > I still do not have an answer to this question. if you have it,
>> >> > > > how
>> >> > > > about
>> >> > > > being a gentleman and sharing it or pointing me to the right
>> >> > > > place.
>> >> > > Thanks.
>> >> > >
>> >> > > The specific answer is in generic(5). While you can construct a
>> >> > > table
>> >> > > that rewrites all addresses to a fixed value, that would be a
>> >> > > mistake.
>> >> > > Consider what will happen to recipient addresses.
>> >> >
>> >> > http://www.postfix.org/ADDRESS_REWRITING_README.html#generic
>> >> >
>> >> > The problem is that it only shows "@localdomain.local"
>> >> > as an example of a wildcard.
>> >>
>> >> The generic(5) document lists all the lookup keys used with a given
>> >> address.
>> >
>> > That was a fairly difficult document for me to understand, but it is
>> > starting to make sense.
>> > But if my answer is in there, I still don't see it.
>> >
>>
>> From http://www.postfix.org/ADDRESS_REWRITING_README.html
>>
>> "Postfix typically uses lookup tables with fixed strings to map one
>> address to one or multiple addresses, and typically uses regular
>> expressions to map multiple addresses to one or multiple addresses."
>>
>> So in other words, if you want to match multiple addresses, then
>> regular expressions might be handy...
>>
>> The postfix docs for regex tables are here:
>> http://www.postfix.org/regexp_table.5.html
>>
>> I'll quote the interesting parts:
>>
>> "TABLE FORMAT
>>       The general form of a Postfix regular expression table is:
>>
>>       /pattern/flags result
>>              When pattern matches the input string, use the cor-
>>              responding result value."
>>
>> "TABLE SEARCH ORDER
>>       Patterns are applied in the order as specified in the  ta-
>>       ble,  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...@domain  mail  addresses  are  not
>>       broken  up  into  their user and domain constituent parts,
>>       nor is user+foo broken up into user and foo."
>>
>> You won't find much about creating regex patterns in the postfix docs,
>> since that's not really a postfix thing.  Here's a guide that should
>> help you create a regex to match whatever you'd like:
>>
>> http://ysomeya.hp.infoseek.co.jp/eng-quick_regex.html
>>
>
> Well, the regex part should be easy. I think it is just ".*"
> But the docs seem to imply that the result cannot be an email address. But

Where do you see this?

>From http://www.postfix.org/canonical.5.html

"REGULAR EXPRESSION TABLES
       This  section  describes how the table lookups change when
       the table is given in the form of regular expressions. For
       a  description  of regular expression lookup table syntax,
       see regexp_table(5) or pcre_table(5).

       Each pattern is a regular expression that  is  applied  to
       the entire address being looked up. Thus, u...@domain mail
       addresses are not broken up into their  user  and  @domain
       constituent parts, nor is user+foo broken up into user and
       foo.

       Patterns are applied in the order as specified in the  ta-
       ble,  until  a  pattern  is  found that matches the search
       string.

       Results are the same as with indexed  file  lookups,  with
       the  additional feature that parenthesized substrings from
       the pattern can be interpolated as $1, $2 and so on."


> as far as I can tell, the doc doesn't define what the result can or cannot
> be.

see above

> I would want the table entry would be:
> .*   m...@example.com
>
> Then I could use the regex like I'm using generic now.
>
> Assuming that would work, would I create the regex table just like the
> generic table, with an entry in main.cf and then run postmap on the text
> file?

pretty much.  examples are in the docs.

Reply via email to