Re: [exim] Discard mail to certain recipients if the subject…

トップ ページ
このメッセージを削除
このメッセージに返信
著者: Evgeniy Berdnikov
日付:  
To: exim-users
題目: Re: [exim] Discard mail to certain recipients if the subject matches a string
On Thu, Apr 06, 2017 at 09:32:04PM +0300, Александр Кириллов via Exim-users wrote:
> I've tried nearly anything I could think of:
>
> Commit by
> Commit\ by
> Commit\sby
> Commit\\ by
> Commit\\sby
> Commit[ ]by
> "Commit by"
> \NCommit by\N
>
> Nothing worked and I'm writing regular expressions in various languages for
> 20+ years. I've failed miserably on this one. )


The simplest way to play with Exim's regular expressions is to run it
with "-be" option:

# exim4 -be '${if match{Commit by}{Commit by}{OK}fail}'
OK
# exim4 -be '${if match{Commit by}{Commit[ ]by}{OK}fail}'
OK

> I understand your point about anchors but all outgoing mail comes to this
> relay from an incident tracker system so the subjects are quite rigid and I
> feel pretty sure this simple match will work well.
>
> Given the fact that I can't write a regexp matching a single space I don't
> really want to explore anything more complex till I get the answer to this
> one.


Your can extract header line from a sample mail (stored in file) as

# exim -bem /path/to/sample.mail '$h_subject'

optionally with "-d+expand" option. If subject is RFC2047-encoded,
try to start with $rh_subject and $bh_subject.
--
Eugene Berdnikov