Re: [exim] auto-reply with exceptions from SQL lookup

Top Page
Delete this message
Reply to this message
Author: Veres Imre
Date:  
To: exim users
Subject: Re: [exim] auto-reply with exceptions from SQL lookup
Hello Bill,

> Yes. Maybe.
>
> SQL INSERT or UPDATE can be called as easily as SELECT, and all of them
> from essentially ANYWHERE in an Exim ~/configure.
>
> The 'maybe' is not SQL limited.


thank you for answering! I'm afraid I did not expressed my problem clearly, because I'd like to find answer to a bit different thing. :-) Imagine that a user goes to vacation, set his/her out-of-office message and he/she can also configure addresses where autoreply messages should not go to. I could create the configuration for everything but these exceptional email addresses.

I want to achieve this in the routers section, where I have a condition to find out if the user was on vacation. I have also a "senders" clause where I'd like to negate addresses (so the autoreply will never goes to those addresses). I'd like to populate the "senders" list from MySQL (so I definitely don't want to INSERT or UPDATE but to SELECT). Unfortunately it does not seem to work.

virtual_vacation:
    driver = accept
    condition = ${if and{ \
                {!match {$h_precedence:}{(?i)junk|bulk|list}} \
                {eq {${lookup mysql{select users.on_vacation from users,domains \
                where localpart = '${quote_mysql:$local_part}' \
                and domain = '${quote_mysql:$domain}' \
                and users.on_vacation = '1' \
                and users.domain_id=domains.domain_id}}}{1}} \
                {!def:header_List-Id: } \
                {!def:header_X-Autoreply-From: } \
                {!match {$h_Subject:} {\N(Out of Office)$\N} } \
                {!match {$h_Subject:} {\N(Auto Reply)\N} } \
                {!match {$h_Subject:} {\N(Auto-Reply)\N} } \
                 }}
    senders = !${lookup mysql{select vn.address from users u,domains d,noautoreply vn \
            where u.localpart = '${quote_mysql:$local_part}' \
            and d.domain = '${quote_mysql:$domain}' \
            and u.domain_id=d.domain_id \
            and vn.user_id = u.user_id}{$value}}
    no_verify
    no_expn
    unseen
    transport = virtual_vacation_delivery


>From the config snippet above, the "senders" part does not work correctly. How can I give many addresses here from MySQL?


(I have already got help to extend the "condition" section with other useful things.)

Thanks again, BR,

Imre