[exim] exim filter question?

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Face
Datum:  
To: exim-users
Betreff: [exim] exim filter question?
Please ignore the first email

hello all,

Lets say i have a user call "a" and i have an alias call "b" for that
user, I would like
to be able to get email coming for user "a" in INBOX folder and email
coming for
alias "b" in folder INBOX-B.

my user filter look like this
-----------------------.filter----------------------------------------
# Exim filter
if $local_part is "a"
then
    save /var/mail/${domain}/${local_part}/.INBOX-B/
elif $local_part is "b"
then
    save /var/mail/${domain}/${local_part}/
endif
-----------------------.filter----------------------------------------



the problem is, if i send an email to "a" or "b" i will get the email
in both folders,
is there is a way i can keep mail coming for "a" in folder INBOX and
mail coming
for "B" in folder INBOX ?


I have Virtual Mail System with Exim and MySQL



routers.conf---------------------------------------------------------------------------------
begin routers
dnslookup:
driver = dnslookup
domains = ! +local_domains
transport = remote_smtp
ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
no_more
autoreply:
driver = redirect
allow_filter
hide_child_in_errmsg
ignore_eacces
ignore_enotdir
reply_transport = autoreply_reply
no_verify
file_transport = address_file
pipe_transport = address_pipe
directory_transport = address_directory
require_files = /var/mail/${domain}/${local_part}/.filter
file = /var/mail/${domain}/${local_part}/.filter
user = mail
group = mail
unseen

mysql_all_domain_alias:
  driver     = redirect
  domains     = +local_domains
  local_parts     = alle
  data         = ${lookup mysql{ \
              SELECT CONCAT(username,'@',domain) AS sendto \
            FROM user \
            WHERE domain='${quote_mysql:$domain}' \
            AND SMTP_allowed='YES' \
          }}
  condition     = ${if or {{\
              def:authenticated_id\
            }{\
                  eq {$sender_host_address}{127.0.0.1}\
            }}\
          }
  file_transport = address_file
  pipe_transport = address_pipe


mysql_alias:

  driver         = redirect
  domains         = +local_domains
  file_transport     = address_file
  pipe_transport     = address_pipe
  data             = ${if or {{\
                       def:authenticated_id\
               }{\
                   eq {$sender_host_address}{127.0.0.1}\
               }}{\
                  ${lookup mysql{ \
                    SELECT sendto \
                    FROM alias \
                    WHERE ( username='${quote_mysql:$local_part}' \
                    AND (domain='${quote_mysql:$domain}' OR domain='') )}}\
               } {\
                ${lookup mysql{ \
                    SELECT sendto \
                    FROM alias \
                    WHERE ( ( username='${quote_mysql:$local_part}' AND
(domain='${quote_mysql:$domain}' OR domain='') ) \
                    AND internal='NO' )}}\
               }}
  local_part_suffix     = +*
  local_part_suffix_optional


mysql_user_condition:
  driver         = accept
  domains         = +local_domains
  caseful_local_part     = true
  condition         = ${if and {{\

                    
                      eq {${lookup mysql{ \
                        SELECT CONCAT(username,'@',domain) AS email \
                        FROM user \
                        WHERE username='${quote_mysql:$local_part}' \
                        AND domain='${quote_mysql:$domain}' \
                        AND SMTP_allowed='YES' \
                    }{true}{false}}}{true}\
                     }{\

                    
                    or {{\

                            
                        and {{\
                            eq {${sg{$local_part_suffix}{^#([^#]+)#[0-9]\{8\}\$}{\$1}}}{before}\
                            }{\
                            lt {$tod_logfile}{${sg{$local_part_suffix}{^#[^#]+#([0-9]\{8\})\$}{\$1}}}\
                                     }\
                           }\
                       }{\
                        and {{\
                            eq {${sg{$local_part_suffix}{^#([^#]+)#.*\$}{\$1}}}{fromdomain}\
                            }{\
                            eq {$sender_address_domain}{${sg{$local_part_suffix}{^#[^#]+#(.*)\$}{\$1}}}\
                                     }\
                             }\
                           }{\
                        and {{\
                            eq {${sg{$local_part_suffix}{^#([^#]+)#.*\$}{\$1}}}{b64from}\
                                }{\
                            eq {${str2b64:$sender_address}}{${sg{$local_part_suffix}{^#[^#]+#(.*)\$}{\$1}}}\
                                         }\
                             }\
                           }\
                    }\
                   }\
                 }\
              }
  local_part_suffix     = #*
  transport         = local_mysql_delivery


mysql_user:
  driver         = accept
  domains         = +local_domains
  condition         = ${lookup mysql{ \
                  SELECT CONCAT(username,'@',domain) AS email \
                FROM user \
                WHERE username='${quote_mysql:$local_part}' \
                AND domain='${quote_mysql:$domain}' \
                AND SMTP_allowed='YES' \
              }{true}{false}}
  local_part_suffix     = +*
  local_part_suffix_optional
  transport         = local_mysql_delivery
  no_more
mysql_catchall:
  driver         = redirect
  # restriction to local domains only may be a double check, as data
takes care of it already ;-)
  domains         = +local_domains
  file_transport     = address_file
  pipe_transport     = address_pipe
  data             = ${lookup mysql{ \
                    SELECT sendto \
                FROM catchall \
                WHERE domain='${quote_mysql:$domain}' \
              }}
system_aliases:
  driver = redirect
  allow_fail
  allow_defer
  data = ${lookup{$local_part}lsearch{/etc/mail.d/exim.d/aliases}}
  file_transport = address_file
  pipe_transport = address_pipe




localuser:
driver = accept
check_local_user
transport = local_delivery
cannot_route_message = Unknown user
routers.conf---------------------------------------------------------------------------------

transports.conf---------------------------------------------------------------------------------
begin transports

remote_smtp:
  driver = smtp
  headers_remove     = X-Spam-Report:X-Spam-Bar


autoreply_reply:
    driver = autoreply
address_directory:
        driver = appendfile
        maildir_format


local_delivery:
  driver = appendfile
  directory     = /var/mail/${local_part}/
  maildir_format
  delivery_date_add
  envelope_to_add
  return_path_add
  group     = mail
  mode         = 0660


local_mysql_delivery:
  driver     = appendfile


  directory     = /var/mail/${domain}/${local_part}/
  maildir_format
  delivery_date_add
  envelope_to_add
  return_path_add
  user         = mail
  group     = mail
  mode         = 0660


  headers_remove = Subject : X-Spam-Flag : X-Spam-Score-Int :
X-Spam-Score : X-Spam-Bar : X-Spam-Report
  headers_add     = "X-Spam-Threshold: ${lookup mysql{ \
                           SELECT spam_threshold \
                    FROM user \
                    WHERE username='${quote_mysql:$local_part}' \
                    AND domain='${quote_mysql:$domain}' \
                    AND SMTP_allowed='YES' \
                      }{$value}{ERROR}}\n\
            X-Spam-Score: $header_X-Spam-Score:\n\
          X-Spam-Score-Int: $header_X-Spam-Score-Int:\n\
          X-Spam-Bar: $header_X-Spam-Bar:\n\
          X-Spam-Report: $header_X-Spam-Report:\n\
                  X-Spam-Flag: ${if def:header_X-Spam-Score-Int:{\
                     ${if >={${eval:${sg{$header_X-Spam-Score-Int:}{^.*\n}{}}}}\
                         {${lookup mysql{ \
                            SELECT spam_threshold*10 \
                            FROM user \
                            WHERE username='${quote_mysql:$local_part}' \
                            AND domain='${quote_mysql:$domain}' \
                            AND SMTP_allowed='YES' \
                        }{$value}{ERROR}}}{YES}{NO}}\
                    }{\
                    UNKNOWN\
                }}\n\
          Subject: ${if def:header_X-Spam-Score-Int:{\
                     ${if >={${eval:${sg{$header_X-Spam-Score-Int:}{^.*\n}{}}}}\
                        {${lookup mysql{ \
                            SELECT spam_threshold*10 \
                            FROM user \
                            WHERE username='${quote_mysql:$local_part}' \
                            AND domain='${quote_mysql:$domain}' \
                            AND SMTP_allowed='YES' \
                        }{$value}{ERROR}}}{${lookup mysql{ \
                                    SELECT spam_tag \
                                    FROM user \
                                    WHERE username='${quote_mysql:$local_part}' \
                                    AND domain='${quote_mysql:$domain}' \
                                    AND SMTP_allowed='YES' \
                                   }{$value}{ERROR}}$h_subject:}{$h_subject:}}\
                }{$h_subject:}}\n\
          X-Delivered-To: $original_local_part@$original_domain
($local_part@$domain)\n\
          X-Message-Age: $message_age"


address_pipe:
driver = pipe
return_output

address_file:
driver = appendfile
delivery_date_add
envelope_to_add
return_path_add

address_reply:
driver = autoreply

transports.conf---------------------------------------------------------------------------------



thank you


--
Sincerely,

Falazemi