

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
5 messages in net.sourceforge.lists.courier-maildropRe: [maildropl] How to put the value ...| From | Sent On | Attachments |
|---|---|---|
| Vini Engel | Sep 26, 2006 8:02 am | |
| Sam Varshavchik | Sep 26, 2006 3:20 pm | |
| Vini Engel | Sep 27, 2006 7:51 am | |
| Devin Rubia | Sep 27, 2006 9:34 am | |
| Vini Engel | Oct 2, 2006 3:18 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Re: [maildropl] How to put the value of two variables into a single variable? {-2.6} | Actions... |
|---|---|---|
| From: | Vini Engel (vi...@fugspbr.org) | |
| Date: | Oct 2, 2006 3:18:34 am | |
| List: | net.sourceforge.lists.courier-maildrop | |
Devin Rubia said the following on 28/09/06 02:35:
On Thu, Sep 28, 2006 at 12:51:25AM +1000, Vini Engel wrote:
Sam Varshavchik said the following on 27/09/06 08:20:
Vini Engel writes:
Hi guys,
I am trying to concatenate the subject of an email message with spamassassin's score. So far I have managed to put the the score in a variable and the actual subject in another but merging the subject variable with the score variable isn't working.
"Isn't working" is completely meaningless, and fails to carry any hint as to the actual problem.
The problem was when trying to concatenate the variables, I was getting always the first variable.
SUBJECT="$MATCH2 $SCORE"
Was giving me just the first variable not the first + the second.
Below is my code:
if (/score=(.*?)\s/) { SCORE=$MATCH1
if (/^Subject: !.*/:h) { SUBJECT="$MATCH2 $SCORE" xfilter "reformail -I \"Subject: $SUBJECT\"" } }
Any hints on what I am missing will be greatly appreciated!
The only thing you're probably missing is that you are using an old version of maildrop, and should update to the current version, that uses an updated regexp syntax.
It is not the very latest one but it is the one before the latest.
Other than that, everything looks correct, and "isn't working" is not a very useful problem report.
I think the "isn't working" was reasonably well explained. The variables were not being concatenated and I didn't find anything about concatenating variables in the docs. So I asked the question...
The problem is not that you are concatenating two variables. The problem is likely that the $SCORE variable is empty to begin with.
No it isn't empty I am logging it to make sure it contains the expected value, I am also logging the other variables to make sure they all have some value. My log is telling me that all the values that I wanted are in the variables, but when I try to concatenate them I keep getting the value of first one.
Don't argue with Sam about versions, he's the one who wrote maildrop. What's the output of 'maildrop -v'?
Sorry, I wasn't arguing. He said it was an old version of maildrop but it actually isn't.
# maildrop -v maildrop 2.0.2 Copyright 1998-2005 Double Precision, Inc. Maildir quota extension enabled. This program is distributed under the terms of the GNU General Public License. See COPYING for additional information.
Your recipe uses multiple mutually exclusive versions of regular expressions, The score is using 2.x (PCRE) while the subject is using 1.x. Now, since you said you got the subject in $MATCH2, you must be using a 1.x version which, assuming you have the very latest 1.x (1.8.1 according to the Changelog), is at least over a year old and 3 versions behind.
You info here was very helpful, I went through my code and changed the regular expression to conform with the 2.x and that did make the difference. Although I was able before to get the subject and put it in a variable some things were really strange. The subject variable was sometimes empty and sometimes had the expected value, I am not sure if that makes any sense as far as maildrop is concerned but that is that happened.
To reiterate what Sam said, you are not being very helpful in describing the problem. Your next step would be to include a sample message with the text that you are trying to match. Another helpful inclusion would be the output from maildrop when you send that sample message through it from the command line with the verbosity turned up.
OK, lecture over. Let's see if we can fix your problem.
Ok that did work but the other way around, I instead changed the way it was matching the subject and then I tried concatenating $match1 and $score.
It works...
This is how I did:
if (/^Subject:(.*)/:h) { log $MATCH log $MATCH1 SUBJECT="$MATCH1 {$SCORE}" log ----$SUBJECT xfilter "reformail -I \"Subject: $SUBJECT\"" }
Assuming you do indeed have a 1.x version, try:
if (/score=!.*! /) { SCORE = $MATCH2 ...
But this may cause problems if there is more than one space in the line (see the necessity for examples?).
Yes I do, sorry I will make sure I include more info next time!
Assuming it's a decimal number followed by a space we could also try:
if (/score=![0-9\.]*! /)
Is the score actually in parentheses? Then we need something like:
No it is not, this is how it looks like:
X-Spam-Status: No, score=2.3 required=6.2
if (/score=\(![0-9\.]*!\) /)
Let's be careful with this, though. We should be matching from the start of line so someone can't insert some X-header and stomp all over your rules. Get some more characters in there!
Yeah you are right, someone could do that and fool maildrop. However, I think it will not happen so easily because spamassassin adds its header at the top of the message and maildrop will match the first score seen.
It now works so I don't need to look at the headers of each message to see the score if I am curious about it or if SA hasn't marked a given message as spam.
I very much appreciated the effort that you put into helping me!
Regards, Vini







