[exim] Problem with Rexexp in Substitution

トップ ページ
このメッセージを削除
このメッセージに返信
著者: Marcel Fehr
日付:  
To: exim-users
題目: [exim] Problem with Rexexp in Substitution
Anyone knows why this Regexp, embedded in a text substitution with sg,
is not working (i.e. no replacement get's done)?

headers_add     = "Subject: [$local_part] ${sg {this is a [test] for \
           not having done so}{\N\[\w*\]\s\N}{}}"


having this line in exim4.conf returns the following subject:
[sysop] this is a [test] for not having done so

testing the pattern with pcretest works and even exim -be
works like charm.

fehr@shran:~$ exim4 -be
 > headers_add     = "Subject: [$local_part] ${sg {this is a [test] for \

                    not having done so}{\N\[\w*\]\s\N}{}}"
headers_add     = "Subject: [] this is a for not having done so"


what I'm trying to achieve is to remove any word-character used in
brackets and leave the rest of the subject intact. the string feeded to
sg is currently a test, if working I would use $h_subject: instead.
the whole config is needed for running a simplified mailinglist.

my config is exim 4.50 on debian sarge with a custom configfile
guided from the specs (see full listing below).

thanks in advanced for any hints, Marcel



/etc/exim4/exim4.conf
###### the MAIN section ######

primary_hostname = shran.labex.ch

# host and labex.ch is defined as local domain
domainlist local_domains = @ : 127.0.0.1 : labex.ch

#only localhost would be allowed (if enabled?)
hostlist relay_from_hosts = 127.0.0.1

#### Definiert den ACL-Part (wird zu SMTP-Zeit aufgerufen)
# SMTP: RCPT (wird fuer jede Adresse einmal aufgerufen)
acl_smtp_rcpt = acl_check_rcpt

# FQDN oder wie wird der domainname zusammengesetzt. Default mal leer
# qualify_domain =
# qualify_recipient =

# obwohl im RFC, keine mail mit der form user@??? annehmen
# allow_domain_literals

# trigger guard, falls mal durch einen config-fehler eine mail als root
transportiert werden sollte
# ist eigentlich schon waehrend dem compilieren fix gesetzt
never_users = root

# do reverse lookup on all remote hosts
host_lookup = *

# disable ident-calls
rfc1413_hosts = *
rfc1413_query_timeout = 0s

percent_hack_domains =

#convert bounce-msg in the queue to frozen after 2 days and leave them
for a month
ignore_bounce_errors_after = 2d
timeout_frozen_after = 30d

# defaultstuff plus smtp-infos
#log_selector = +smtp_connection +smtp_protocol_error +smtp_syntax_error
+deliver_time +received_recipients
log_selector = +all

# wem wird SMTP-AUTH angeboten: jedermann aus worf und localhost
# auth_advertise_hosts = !worf : !127.0.0.1

###### the Auth section #######
begin authenticators
# annika als server
# fixed_cram:
# driver     = cram_md5
#  public_name   = CRAM-MD5
#  server_secret = ${if eq{$1}{bambole}{oRn2hoLb}fail}


# annika als client gegenueber calisto als smarthost
fixed_login :
   driver     = plaintext
   public_name    = LOGIN
   client_send   = : smtp : hepwsm


###### the ACL section (aka shall we accept?) ######
begin acl

#----------------------------
# this one runs after each RCPT command
acl_check_rcpt:

##### accept unconditionally all recipients in messages that are #####
# submitted by SMTP from local processes using the standard
# input and output (that is, not using TCP/IP)
accept hosts = :

   ##### Character Test #####
   # denies bad characters in the local part for local domains
#  deny    domains       = +local_domains
#      log_message   = $sender_host_address has bad characters
#          local_parts   = ^[.] : ^.*[@%!/|]


   # and be less restrict with all other (routed) domains
#  deny    domains       = !+local_domains
#      log_message   = $sender_host_address has bad characters
#          local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./


   ##### accepts the postmaster@ for all domains listed in local_domains 
but only sent from worf or localhost #####
   accept  hosts        = worf : 127.0.0.1
      local_parts   = postmaster : root
           domains       = +local_domains


   ##### check of the sender could be reached (basic verification checks 
only the domain) #####
   #  require verify       = sender


   ##### Accept without auth only, if from worf or localhost #####
   # accepts the incoming recipient address if its domain is one of the 
local domains
   accept  hosts        = worf : 127.0.0.1
      domains       = +local_domains
           endpass
           message       = unknown user
           # verify        = recipient


# accept if authenticated with CRAM-MD5
# accept authenticated = fixed_cram

   ##### the end #####
   # if a msg reaches this, it will be denied (cause its the end, baby)
   deny    message       = relay not permitted


###### the ROUTER section (aka where to go!) ######
begin routers

# checks if the msg is spam-tagged and user want's to keep it. else delete
   delete_spam:
    driver         = accept
    local_parts    = ! /etc/exim4/spam.lovers
    condition    = "${if and {\
                {def:h_X-Spam-Status:} \
                {match {$h_X-Spam-Status:}{Yes}} \
               } {1}{0}}"
    transport    = sent_to_bin


# checks, if the user is in /etc/aliases and replaces them accordingly
   system_aliases:
       driver         = redirect
      allow_fail
       allow_defer
       data         = ${lookup{$local_part}lsearch{/etc/aliases}}
    # user         = exim
       file_transport     = address_file
       pipe_transport     = address_pipe


# checks, if the mail is sent to a mailinglist
   lists:
    driver        = redirect
    file        = /etc/exim4/lists/$local_part
    headers_remove    = Subject : Reply-to
    headers_add    = "Subject: [$local_part] ${sg {this is a \
               [test] for not having done so\     
               }{\N\[\w*\]\s\N}{}}"
#    headers_add    = "Subject: [$local_part] ${sg {$h_subject: \
               }{\N\[\w*\]\s\N}{}}"
    forbid_pipe
    forbid_file
    skip_syntax_errors



#handles all connections except @bambole.ch & @annika.labex.ch
   dnslookup:
    driver         = dnslookup
       domains     = ! +local_domains
       transport     = smarthost
       ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
       no_more


# after all, only valid localusers stay (otherwise it get's bounced)
#  localuser:
#      driver         = accept
#      check_local_user
#      transport     = local_delivery


# after all, only valid localusers stay (otherwise it get's bounced)
   procmail:
       driver         = accept
       check_local_user
       transport     = procmail_pipe


###### the TRANSPORT section (aka what to do!) ######
begin transports

# deletes the message without further notice
   sent_to_bin:
    driver        = appendfile
    file        = /dev/null


# schickt alles an calisto
smarthost:
    driver         = smtp
         hosts        = calisto.umlaufbahn.ch
    hosts_require_auth = calisto.umlaufbahn.ch
    hosts_override    


# deliver over SMTP, all options are default
   remote_smtp:
       driver         = smtp


# deliver local
   local_delivery:
       driver         = appendfile
       file         = /var/mail/$local_part
      delivery_date_add
       envelope_to_add
       return_path_add
       group         = mail
       mode         = 0660


# deliver through procmail
procmail_pipe:
    driver         = pipe
    command     = /usr/bin/procmail -d $local_part
    group        = mail
    check_string    = "From "
    escape_string    = ">From "
      delivery_date_add
       envelope_to_add
       return_path_add


# handles connection over pipes (used by /etc/alias)
   address_pipe:
       driver         = pipe
       return_output


# handling delivers to files caused from redirection (etc/alias)
   address_file:
       driver         = appendfile
       delivery_date_add
       envelope_to_add
       return_path_add


###### the RETRY section (aka what to do if you can't deliver!) ######
begin retry
* * F,2h,15m; G,16h,1h,1.5; F,4d,6h

# This causes any temporarily failing address to be retried every 15
minutes for 2 hours, then at
# intervals starting at one hour and increasing by a factor of 1.5 until
16 hours have passed, then
# every 6 hours up to 4 days. If an address is not delivered after 4
days of failure, it is bounced.