Re: [exim] mail2news gateway configuration

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Tony Finch
Ημερομηνία:  
Προς: Joerg Sommer
Υ/ο: exim-users
Αντικείμενο: Re: [exim] mail2news gateway configuration
On Mon, 3 Oct 2005, Joerg Sommer wrote:
>
> mail2news:
>   condition = ${lookup{$local_part}lsearch{/etc/exim4/mail2news}}
>   driver = redirect
>   data = "|/usr/lib/news/bin/mailpost -a usenet@??? \
>     ${extract {1}{,}{${lookup{$local_part}lsearch{/etc/exim4/mail2news}}}}"
>   pipe_transport = address_pipe
>   errors_to = postmaster
>   headers_add = "Subject: ${sg {$rh_subject:} \
>     {\\\\[${extract {2}{,}{${lookup{$local_part}lsearch{/etc/exim4/mail2news}}}}\\\\] }{}}\n"
>   headers_remove = newsgroups:distribution:x-spam-report:received:errors-to:subject

>
> Currently all my addresses are named ml- or nl-, which makes the check
> for mail2news_admin simple. But if I would not use such prefixes, how
> often becomes the ${lookup evaluated? Does exim cache the result?


Yes. However you can make the router much more readable as follows:

mail2news:
  local_parts = lsearch;/etc/exim4/mail2news
  driver = redirect
  data = "|/usr/lib/news/bin/mailpost -a usenet@??? \
    ${extract {1}{,} {$local_part_data} }"
  pipe_transport = address_pipe
  errors_to = postmaster
  headers_add = Subject: ${sg {$rh_subject:} \
    {\\\[${extract {2}{,} ($local_part_data} }\\\] }{} }
  headers_remove = newsgroups:distribution:x-spam-report:received:errors-to:subject



Always check that the condition you are writing isn't supported directly
by a standard condition: you will avoid a lot of ugly string expansions.

Note that headers_add doesn't need a trailing \n or quotes.

I think it would be better to do the Subject: mangling in the mailpost
program - perhaps make the subject tag a command-line argument?


Tony.
--
<fanf@???> <dot@???> http://dotat.at/ ${sg{\N${sg{\
N\}{([^N]*)(.)(.)(.*)}{\$1\$3\$2\$1\$3\n\$2\$3\$4\$3\n\$3\$2\$4}}\
\N}{([^N]*)(.)(.)(.*)}{\$1\$3\$2\$1\$3\n\$2\$3\$4\$3\n\$3\$2\$4}}