rich gregory wrote:

> Yes that's exactly what I want to do.  REPLY using as my FROM
> address the same address that the sender used to write TO me.

The obvious approach, which I failed to mention in my last message, is
just:

%FROM=""%FROM="%OTOADDR"%-
%REPLYTO=""%REPLYTO="%OTOADDR"%-

But, if the message you're replying to was sent to multiple
recipients and your address wasn't the first one in the To list,
you'll end up replying as someone else. That's why I don't like it as
a solution, but it is easy. That said...

> Below, readers, is a discussion of the example code suggested as a possible 
> solution...

GM>> ... use something like (version 2 syntax):
GM>> %SETPATTREGEXP("(?i)[EMAIL PROTECTED]")%-
GM>> %_TO_ADDR="%REGEXPMATCH('%OTOLIST, %OCCLIST')"%-
GM>> 
%IF:"%_TO_ADDR"<>"":"%FROM=''%FROM='%_TO_ADDR'%REPLYTO=''%REPLYTO='%_TO_ADDR'":""%-

> How do I decode what this does?  I will try it w/o knowing that
> answer, but I would like to know this stuff!

I'll explain it as best I can. One of the big weaknesses of TB! is its
lack of good documentation. All the macros are defined in the help
file, but there aren't any examples of their usage. The Macro and QT
repository:

http://www.silverstones.com/thebat/Library.html

is a good resource, but doesn't offer much in the way of explanations.

This stuff can look quite confusing, especially when regular
expressions are involved, but usually isn't so bad. Here's how this
code works:

>%SETPATTREGEXP("(?i)[EMAIL PROTECTED]")%-

This line defines the regular expression (regex) pattern that will be
used pick out your address. This is the key to this method. In my
case, all of the possible addresses are similar so I can match them
with a relatively simple regex. Your case may be harder. There's a
good regex tutorial (with some TB! applications) at:

http://www.regenechsen.de/regex_en/regex_1_en.html

Under the heading "3. Simple Patterns", the author gives a link to a
dll that will let you test regex patterns. If you plan to mess with
this stuff I would encourage you to get it. I find it *very* helpful
in tinkering with matching strings. Folks in TBTECH may also be of
help.

Turning back to the first line of code, you'll have to replace
"(?i)[EMAIL PROTECTED]" with a string that'll match any one of your
addresses.

>%_TO_ADDR="%REGEXPMATCH('%OTOLIST, %OCCLIST')"%-

'%OTOLIST, %OCCLIST' concatenates the contents of the To and CC fields
from the original message. This is fed to the REGEXPMATCH macro, which
uses the match string previously defined to look for a match. The
result of the match is assigned to the _TO_ADDR variable for use in
the next line. With any luck, it will contain one of your addresses.
If there was no match _TO_ADDR will contain an empty string.

>%IF:"%_TO_ADDR"<>"":"%FROM=''%FROM='%_TO_ADDR'%REPLYTO=''%REPLYTO='%_TO_ADDR'":""%-

This line says: If _TO_ADDR is not an empty string, set the From and
ReplyTo fields with its contents after clearing any existing values.
If _TO_ADDR is empty do nothing, which will leave the account defaults
in place.

The %- at the end of each line simply allows the code to be broken
into multiple lines without adding newlines to the message. Try
leaving them off to see what I mean.

GM>> It will use the first matched address from the To and CC fields in the original
GM>> message, or the account's default if nothing matches.

> By "first matched" I hope this means I can process, with this
> filter, unlimited (wildcard) addresses at 7 (or more) different
> domains.

I'm no expert on regular expressions, but you might be able to use
something like:

(?i)[^\s,;<]+@(domain1|domain2|domain3)\.com

(?i) = case insensitive
[^\s,;<] = any character that's not whitespace, "," ";" or "<"
+ = one or more of the above
(domain1|domain2|domain3) = domain1 or domain2 or domain3
\. = match a literal "." character.

Alternatively:

(?i)[^\s,;<]+@(domain1\.com|domain2\.net|domain3\.com)

You may have to tinker with this, especially the [^\s,;<] part. This
was off the top of my head.

> This behavior needn't be restricted to the Inbox BUT MUST allow
> folder templates to over-ride this with their identities.

If you do this at the account level, then any folder templates should
automatically take precedence.

GM>> Out of curiosity, why would you use a ReplyTo that's identical to the
GM>> From field?

> Why not?  It seems like less work setting one parameter as a
> slave of the other so that every time I needed to change the FROM
> address I could count on the REPLYTO not being additional typing!

I've blanked out the ReplyTo information from all my accounts, so my
messages don't have a ReplyTo unless I add it. I figure that makes my
life easier when I'm doing stuff like this. Anyone know if this is a
bad idea?

Anyway, I hope this is helpful.

-- 
George

Using TB! 2.01.20 on Windows XP Pro 5.1, Build 2600, Service Pack 1.


________________________________________________
Current version is 2.01.3 | "Using TBUDL" information:
http://www.silverstones.com/thebat/TBUDLInfo.html

Reply via email to