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

Góra strony
Delete this message
Reply to this message
Autor: Todd Lyons
Data:  
Dla: Veres Imre
CC: exim-users
Temat: Re: [exim] auto-reply with exceptions from SQL lookup
On Sun, May 8, 2011 at 10:26 AM, Veres Imre <six@???> wrote:
> Dear All,
>
> I'm working on the perfect out-of-office/autoreply solution with per-user settings stored in MySQL database. ;-) I stucked with that part when a user can set email addresses whom auto-replies will never be sent to. These addresses can be shared mailboxes, close colleagues etc. The goal is to send vacation autoreply to everyone but these addresses.
>
> I'd like to solve this with the "senders" keyword where I could negate all the addresses which are on the database table. Every other functions work perfectly except this. I hope you can point out what went wrong.
>
> The problem is that the autoreply message is going to be sent doesn't matter whether the address was listed in the database or not.
>
> As I told I use Mysql; users table contains localpart and the userid, domains table the domain name and domain_id, and I have created a table called "noautoreply" which contains user_id reference and the address that should be excluded from autoreply function.
>
> Routers section:
> ----------------
> 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}} \


So you check if a particular user is in the database (a local user)
and then you do send a vacation message if they are found. Off the
cuff it seems like you're missing a not in front of that eq{}
function.

>                {!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} } \
>                 }}


I found this somewhere on the web, can't recall exactly where, but
it's a bit more thorough list, consider adding some of it to yours:

AUTORESPONDER_BULK_REGEX = ${if or { \
              { match {$h_precedence:} {(?i)junk|bulk|list} } \
              { eq {$sender_address} {} } \
              { def:header_X-Cron-Env: } \
              { def:header_Auto-Submitted: } \
              { def:header_List-Id: } \
              { def:header_List-Help: } \
              { def:header_List-Unsubscribe:} \
              { def:header_List-Subscribe: } \
              { def:header_List-Owner: } \
              { def:header_List-Post: } \
              { def:header_List-Archive: } \
              { def:header_Autorespond: } \
              { def:header_X-Autoresponse: } \
              { def:header_X-Autoreply-From: } \
              { def:header_X-eBay-MailTracker: } \
              { def:header_X-MaxCode-Template: } \
              { match {$h_X-Auto-Response-Suppress: } {OOF} } \
              { match {$h_X-OS:} {HP Onboard Administrator} } \
              { match {$h_X-MimeOLE:} {\N^Produced By phpBB2$\N} } \
              { match {$h_Subject:} {\N^Yahoo! Auto Response$\N} } \
              { match {$h_Subject:} {\N^ezmlm warning$\N} } \
              { match {$h_X-FC-MachineGenerated:} {true} } \
              { match {$message_body} {\N^Your \"cron\" job on\N} } \
              { match {$h_Subject:} {\N^Out of Office\N} } \
              { match {$h_Subject:} {\N^Auto-Reply:\N} } \
              { match {$h_Subject:} {\N^Autoresponse:\N} } \
              { match {$h_Subject:} {\N(Auto Reply)$\N} } \
              { match {$h_Subject:} {\N(Out of Office)$\N} } \
              { match {$h_Subject:} {\Nis out of the office.$\N} } \
              { match {$h_From:} {\N(via the vacation program)\N } } \
              } {no}{yes} }



> (By the way, I have another little problem; I set the "log" in the transport section but the file is never created and I couldn't find any particular reason for this.)


You don't specify any user or group for exim to deliver as. If the
user's maildir is not the same user that exim is running as, then it
can't create the file(s).

--
Regards...      Todd
"It is the nature of the human species to reject what is true but
unpleasant and to embrace what is obviously false but comforting."
"You might be a skeptic if you have pedantically argued the topic of pedantry."