Re: Mapping one domain to another (mysql)

2012-08-08 Thread email builder
>> >> Postfix expects an empty set (i.e. no rows returned) if it is to >> >> respond >> >> negatively that a virtual alias does not exist. >> >> Returning NULL does not equal no rows returned. >> >> >Are you sure?? >> >> 100% confirmed. To return NOTFOUND, you MUST return NO RESULT. > >

Re: Mapping one domain to another (mysql)

2012-08-08 Thread email builder
>> Postfix expects an empty set (i.e. no rows returned) if it is to respond >> negatively that a virtual alias does not exist. >> Returning NULL does not equal no rows returned. > > email builder: >> Are you sure?? > > 100% confirmed. To return NOTFOUND, you MUST return NO RESULT. So with

Re: Mapping one domain to another (mysql)

2012-08-08 Thread Viktor Dukhovni
On Wed, Aug 08, 2012 at 04:08:03PM -0400, Wietse Venema wrote: > email builder: > > Postfix expects an empty set (i.e. no rows returned) if it is to respond > > negatively that a virtual alias does not exist. > > Returning NULL does not equal no rows returned. > > email builder: > >Are you sure??

Re: Mapping one domain to another (mysql)

2012-08-08 Thread Wietse Venema
email builder: > Postfix expects an empty set (i.e. no rows returned) if it is to respond > negatively that a virtual alias does not exist. > Returning NULL does not equal no rows returned. email builder: >Are you sure?? 100% confirmed. To return NOTFOUND, you MUST return NO RESULT. Wie

Re: Mapping one domain to another (mysql)

2012-08-08 Thread email builder
>> I don't think mine is so confusing as you suggest if you take a second > to understand it.  Maybe if you read it with some whitespace: >> >> select >>     if ('%d' = 'example-2.com', >>         IFNULL( >>             (select dest from aliases where addr = > '%u...@example.com'), >>  

Re: Mapping one domain to another (mysql)

2012-08-08 Thread Brian Evans - Postfix List
On 8/8/2012 3:03 PM, email builder wrote: > > I don't think mine is so confusing as you suggest if you take a second to > understand it. Maybe if you read it with some whitespace: > > select > if ('%d' = 'example-2.com', > IFNULL( > (select dest from aliases where addr =

Re: Mapping one domain to another (mysql)

2012-08-08 Thread email builder
> I've found that in conjunction with a 2nd query (the > original > normal one), everything seems to work as expected (including > aliases with only local parts like "postmaster") > > But I'm still unsure if this kind of query is correct, if > I'm > on th

Re: Mapping one domain to another (mysql)

2012-08-08 Thread Tom Hendrikx
On 8/8/12 11:27 AM, email builder wrote: > query = select if ('%d' = 'example-2.com', > IFNULL((select dest from aliases where addr = '%u...@example.com'), (select addr from users where addr = '%u...@example.com')), NULL) I've found that in conjunction with a 2nd qu

Re: Mapping one domain to another (mysql)

2012-08-08 Thread email builder
>>> query = select if ('%d' = 'example-2.com', >>> IFNULL((select dest from >>> aliases where addr = '%u...@example.com'), (select addr from users >>> where addr = '%u...@example.com')), NULL) >>> >>> I've found that in conjunction with a 2nd query (the original >>> normal one), everythin

Re: Mapping one domain to another (mysql)

2012-08-08 Thread Tom Hendrikx
On 8/7/12 8:58 PM, email builder wrote: >>> Probably the best lesson to learn from postfixadmin is: you can >>> have > >>> more than one lookup table in postfix per main.cf directive. >>> Postfixadmin uses 2 separate queries for "regular" aliases and >>> domain aliases. >>> >>> from main.cf: vi

Re: Mapping one domain to another (mysql)

2012-08-07 Thread email builder
>> Probably the best lesson to learn from postfixadmin is: you can have >> more than one lookup table in postfix per main.cf directive. >> Postfixadmin uses 2 separate queries for "regular" aliases and >> domain >> aliases. >> >> from main.cf: >> virtual_alias_maps = /etc/postfix/mysql_vir

Re: Mapping one domain to another (mysql)

2012-08-06 Thread email builder
>>> This causes a bounce instead of reject. Do I have to add a clause for >>> this to my query? I start to feel like I'm doing things Postfix > should >>> be doing. There must be a more simple way to do this? >> >> postfixadmin have domain-alias support fits 100% to subject, makes sense >>

Re: Mapping one domain to another (mysql)

2012-08-06 Thread Tom Hendrikx
On 8/6/12 2:28 PM, Benny Pedersen wrote: > Den 2012-08-06 12:03, email builder skrev: > >> This causes a bounce instead of reject. Do I have to add a clause for >> this to my query? I start to feel like I'm doing things Postfix should >> be doing. There must be a more simple way to do this? > > p

Re: Mapping one domain to another (mysql)

2012-08-06 Thread Benny Pedersen
Den 2012-08-06 12:03, email builder skrev: This causes a bounce instead of reject. Do I have to add a clause for this to my query? I start to feel like I'm doing things Postfix should be doing. There must be a more simple way to do this? postfixadmin have domain-alias support fits 100% to su

Re: Mapping one domain to another (mysql)

2012-08-06 Thread email builder
>> So I came up with this: >> >> query = select if ('%d' = 'example-2.com', IFNULL((select > dest >> from aliases where addr = '%u...@example.com'), (select addr from > users >> where addr = '%u...@example.com')), (select dest from aliases where > addr = >> '%s')) >> >> This seems to

Re: Mapping one domain to another (mysql)

2012-08-06 Thread email builder
> So I came up with this: > > query = select if ('%d' = 'example-2.com', IFNULL((select dest > from aliases where addr = '%u...@example.com'), (select addr from users > where addr = '%u...@example.com')), (select dest from aliases where addr = > '%s')) > > This seems to work in all cases exc

Re: Mapping one domain to another (mysql)

2012-08-06 Thread email builder
> I was trying to find a SQL example how to alias email that is addressed > to everyone at a secondary domain to my primary domain.  I mean: > > I have many virtual users set up for example.com, I added a new domain, > example-2.com and I want any email going to example-2.com to be delivered t