Hi folks,
The short question:
===================
I'm looking for a string expansion item in Exim that will allow me to
repeat a character sequence n times.
For example, I'd like something like this
${repeat{\\+}{3}}
to produce this:
\+\+\+
"Does such a thing exist?" he asked, somewhat hopefully. I've read
"String expansions" through and can't find it, but perhaps it's a new
feature that's arrived since 4.20?
The reason:
===========
I have a transport that is only used for certain local recipients:
remote_smtp_subject_spam:
driver = smtp
no_delay_after_cutoff
headers_remove = \
${if \
match {$h_X-Spam-Score:}{\N\+\+\+\+\+\N} \
{subject} {} \
}
headers_add = \
${if \
match {$h_X-Spam-Score:}{\N\+\+\+\+\+\N} \
{Subject: ***SPAM*** $h_Subject:} {} \
}
This tags the Subject line for messages with a spam score of 5 or
greater. I have customers who only allow filtering for some recipients,
and whose staff can't filter on the X-Spam-Score header.
But now I want the threshold to be a per-user value, obtained from a
database.
Sure, I could store '\+\+\+' in the database, but that feels very, very
ugly. So I'd like to be able to do something like this:
MAILBOX_SPAMTAG_THRESH= \
${lookup \
pgsql{ \
SELECT SpamTagScore \
FROM Mailbox \
WHERE Name = '${quote_pgsql:$local_part}' \
} \
{$value} \
{no} \
}
remote_smtp_subject_spam:
driver = smtp
no_delay_after_cutoff
headers_remove = \
${if \
match {$h_X-Spam-Score:}{${repeat{\\\\+}{MAILBOX_SPAMTAG_THRESH}}} \
{subject} {} \
}
headers_add = \
${if \
match {$h_X-Spam-Score:}{${repeat{\\\\+}{MAILBOX_SPAMTAG_THRESH}}} \
{Subject: ***SPAM*** $h_Subject:} {} \
}
Hope springs eternal. :-)
Ciao,
Sheldon.