Pages: 1
RSS
How to automatically remove something from subject, Removing **SPAM**
 
Hi all!
I have a pretty annoying problem.
Due to server filters, some mails i receive have the subject something like "**SPAM** <Subject>"
When I reply them, the subject becomes "Re: **SPAM** <Subject>".

Now, the question. How can I have the "**SPAM**" word automatically removed when I reply? (thus having the subject like "Re: <Subject>").
Currently, I manually delete **SPAM** from subject when I encounter it.

Big thanks!
 
I don't know if The Bat can do that automatically but perhaps you are attacking the problem from the wrong end. If these are not true Spam emails, then your server filters need to be "fixed." Is this something your ISP automatically does or are you using some type of Spam identifying software before it gets to The Bat?
 
Unfortunately, regarding server filters, I cannot set them and I am not the ISP.
Yes, due to high spam level I use SpamPal.
Some emails are wrong marked as SPAM ==> and here goes my problem with reply.
 
Unfortunately, it isn't possible to remove the **SPAM** from the incoming message, but it is possible to remove it from your reply.
It's possible to do the latter by inserting this piece of regular expressions in your reply template(s):

%SetPattRegExp='(\*\*SPAM\*\*)?(.*)'%-
%RegExpBlindMatch='%OSubj'%-
%Subject="Re: %SubPatt='2'"%-

I don't know whether this is the optimal piece of coding, but I tested it and it does what you said you wanted, while it still leaves the original subject intact when the **SPAM** part is missing.
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
 
Thank you very much, it worked.

Is there any tutorial regarding
%SetPattRegExp, %RegExpBlindMatch and the like?

I myself am a programmer, but I still cannot understand how these commands work from the The Bat help (no real world examples provided).

What does "?(.*)'" do for example?
 
The help is rather extensive on the regular expression part, so try to study that.

The SetPattRegExp sets the pattern you're looking for, the RegExpBlindMatch sets the location and the way you're trying to extract info. (The help states that you need SubPatt to extract data when you're using RegExpBlindMatch.)

The pattern was rather easy, I needed to look for **SPAM** followed by some text.
As the * has a special meaning for regular expressions I had to escape it with a \.
That gave me \*\*SPAM\*\*
In good messages the **SPAM** part would be missing in the subject, so I made (\*\*SPAM\*\*)? The question mark means that the character (sequence) has to occur zero or one time.
Then I had to take the rest of the subject line, that was done with (.*) the dot stands for any character and the asterix stands for zero or more instances, so that gives me anything in the subject line.

The %RegExpBlindMatch='%OSubj' set the old subject as the string to match. (It's also possible to look for stuff in the whole message body or in one or more headers.)
The %SubPatt='2' told to insert the second part that was enclosed by ().

Check http://www.ritlabs.com/en/forum/read.php?FID=6&TID=3142&MID=13950 for another regexp example on this forum or check http://www.silverstones.com/thebat/Library.html for more life examples. There's also the tutorial at http://www.silverstones.com/thebat/Regex.html
Both Silverstones URLs are part of the official TB FAQ, you'll get there by selecting 'Help -> FAQ page' from TB's menu.
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
 
Thank you very very much, it's all clear now. :)
Pages: 1