Re: SV: SV: [Exim] I need help to implement sendder rules fo…

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: Flemming Christensen
CC: Joachim Wieland, Exim-Users (E-mail)
Subject: Re: SV: SV: [Exim] I need help to implement sendder rules for virtual domain users
I always split up complicated expansions like this when debugging:


condition = ${if and
               {
               eq {
                    ${lookup mysql
                        {select local_only from user where
                         mailadresse='${quote_mysql:$local_part@$domain}'
                        }
                     }               <<<<<<<
                     {$value}
                  }


That looks like your problem. The } I have indicated terminates the
${lookup. So the {$value} isn't much use here. Mind you, it will just be
an empty string, so it won't do much (but some of the spaces will be
part of the looked up value). Just delete "${value}".

                  {1}{yes}{no}


There's the next problem. eq{x}{y} is a complete condition. Since it is
part of an "and", it must be enclosed inside {}. That's what Exim is
complaining about. You don't want "{yes}{no}" there.

               }


               {
               eq {
                    $lookup mysql{select domain from user
                     ^
                     ^
               Missing { here.


                                  where domain = '${domain:$sender_address}'
                                  }
                     }                 <<<<<<<<<<<<< same remark
                     {$value}          <<<<<<<<<<<<<
                  }


                  {}{yes}{no}          <<<<<<<< and here
               }


             <<<<<<<<<<< This is where you want "{yes}{no}"


             }


If is often helpful to use macros to define long things like SQL
queries, so that the options are easier to read. You need something like

condition = ${if and {                    \
                     {eq {LOOKUP1}{1}}    \
                     {eq {LOOKUP2}{}}     \
                     }                    \
                 {yes}{no}}



where you define the macros (at the top of the config) like so:

LOOKUP1=${lookup mysql{select local_only from user where \
                       mailadresse='${quote_mysql:$local_part@$domain}'}}






--
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.