Heya David,
luck was what I needed. I had tried unsuccessfully to get it working for maybe one hour, before posting my question. I tried again, and this time (after another hour) IT WORKS.
The trouble was not the regex search pattern. Not because I'm such a genius, but because I could google for it. The problem that took me so long was getting the macro to take the regex result of search in the email for the domain.
I did not understand how to do that, but by first trying the appealing versions and then the weird versions (from my inexperienced point of view) I stumbled over the right one that works. I always thought that the "%REGEXPMATCH=%TOADDR" bit would get the domain string and I would use the %REGEXPMATCH then again in the IF part, you know like a system variable. Like so:
%IF:"%REGEXPMATCH"="@example.com": ^^^^^^^^^^^^^^ thought this would BE the regex result, and IF it's the correct domain it would be like "@example.com" = "@example.com" -> TRUEDidn't work. Only when I used that full code piece in the IF part, it worked.
the working part results (I think) from the macro's POV in:
CODE:
%IF:"%REGEXPMATCH=%TOADDR"="@example.com":
BECOMES with the wanted domain:
%IF:"@example.com"="@example.com": --> TRUE
OR
%IF:"@wrongdomain.fr"="@example.com": --> FALSE
Learned something about TB macros, and I hope I will remember it at the next time I'll try do something nifty.
So this I just put at the beginning of the template, this is the regex part 1 - setting the pattern
Code |
---|
%SETPATTREGEXP="@(.*)$"%- |
to see what regex actually finds (not needed after one knows that part works), it outputs what the regex sees as the domain part in the TO field:
Code |
---|
-->%REGEXPMATCH=%TOADDR<--
|
then here comes the thing that does the magic:
Code |
---|
%IF:"%REGEXPMATCH=%TOADDR"="@example.com":%SUBJECT="insertyourtext - %SUBJECT"%-
|
The %SUBJECT="insertyourtext - %SUBJECT"%- prevents the deletion of whatever text one was typing when going through the header fields in a new mail.
So one has to type into that macro the "example.com" domain and the text (like in my case my customer ID) at "insertyourtext".
all this I have put into my macro that gets started when I open a new message window.
sorry for the very long entry for a very short solution.
cheers,
Jürgen