On Fri, 13 Mar 2009 at 05:35:13 -0400, Leonard wrote:> On Thu, Mar 12, 2009 at 
7:39 PM, MAU <[email protected]> wrote:
> My point is that I want to send the e-mail to _both_ addresses. If I
> have two or more addresses on the same line addresses on the same
> line, I will be able to do that, but then the reply template will not
> be picked up because the address in the address book, by definition
> does not match the address in the incoming e-mail. So, to get the best
> of all worlds, I need two (or more) address entries; to send mail to
> both (or all of this person's addresses, I have to select each of
> them. (I think we are beginning to go around in circles on this
> thread.)

This was one reason I made use of the memo field to store secondary email
addresses. Miguel hates this because it relies heavily on regular
expressions, but if you have a bit of patience you might like to try it.

Firstly include the line:

%QInclude(Add_CC)%-

in your New Message, Reply and Forward templates for your accounts.


Then in your address book entry include one email address in the usual
place and include the second email address in the memo field (on the
"Other" tab) in this form on a line by itself:

<CC>[email protected]</CC>

It doesn't have to be the only information in the memo tab, just by itself
on one line.


Then you need to set up the following quick templates. There are 4 of them,
and you need them all. They call one another in a chain and the effect is to
look for secondary addresses like the one above and automatically add them
in the CC field. If you were to put the address between BCC tags like this:
<BCC>[email protected]</BCC>
the address would be added to the BCC field.

If there are multiple recipients in the TO or CC fields, the macros will do
this for each person.

Copy and paste the contents between the marked Start and End lines. Please
make sure that long lines do not get wrapped in the Quick Template editor.

The first macro is called "Add_CC" (without the quotes of course).

====[ Start Add_CC ]====
%REM="
   Include secondary addresses noted in memo field between <CC> or <BCC> tags.
   A token is identified by a line of the form:
   <CC>XXX</CC>
   or
   <BCC>XXX</BCC>

Usage:
   %QInclude(Add_CC)

   Written by Robin Anson 4 Dec 2005
   updated to include BCC 3 Sep 2008
  
"%-
%-
%REM="
   %_AddCC_List stores the original list of recipients
   %_AddCC_Temp stores the list of recipients yet to be processed
   %_AddCC_CC stores the CC list
"%-
%-
%rem=^   Initialise variables ^%-
%_AddCC_Done="yes"%-
%_AddCC_List="%ToList"%-
%_AddCC_Temp="%_AddCC_List, %CCList"%-
%_AddCC_CC="%CCList"%-
%_AddCC_BCC=""%-
%CC=""%-
%BCC=""%-
%-
%_FTT_Status="0"%-
%QInclude(FindTknType0,"%_AddCC_Temp","CC","%_AddCC_CC")%-
%CC="%_FindTkn_Text"%-
%_FTT_Status="0"%-
%QInclude(FindTknType0,"%_AddCC_Temp","BCC","%_AddCC_BCC")%-
%BCC="%_FindTkn_Text"%-
%SetHeader("To","%_AddCC_List")%-
=====[ End Add_CC ]=====

The next is "FindTknType0"

====[ Start FindTknType0 ]====
%Rem='

FindTokenType0 returns a list of values of a single token from an XML
style entry in the memo fields of a list of address book entries.
 
The list contains the value for that token if it exists for each address
in the address list

Usage:
   %_FTT_Status="0"
   %QInclude(FindTknType0,"Address_list","Token","start_value")

Returns:
   %_FindTkn_Text
   
'%-
%_FT_AL="%_1"%-
%_FT_Token="%_2"%-
%_FT_start="%_3"%-
%If:|%_FT_AL|<>||%-
:|%If:"%_FTT_Status"="0"%-
:"%_FT_AlHold='%_1'%-
%_FTT_Status='1'%-
%_FindTkn_Text='%_FT_start'"%-
:""%-
%QInclude(ParseAddressList,"%_FT_AL")%-
%SetHeader("To","%_FirstAddress")%-
%_FT_AL="%_RemainingAddressList"%-
%_FT_TmpTxt="%QInclude(Get_Memo_Attribute,'%_FT_Token','%_FT_default')"%-
%If:^%_FT_TmpTxt^<>^^%-
:^%If:+%_FindTkn_Text+=++%-
:+%_FindTkn_Text='%_FT_TmpTxt'+%-
:+%If:/%SetPattRegexp='%_FT_TmpTxt'%RegexpMatch='%_FindTkn_Text'/=//%-
:/%_FindTkn_Text='%_FindTkn_Text, %_FT_TmpTxt'/://+^%-
:^^%-
%QInclude(FindTknType0,'%_FT_AL','%_FT_Token','%_FT_start')|%-
:||%-
=====[ End FindTknType0 ]=====

The third is "ParseAddressList"

====[ Start ParseAddressList ]====
%Rem=^

Usage:
   %QInclude(ParseAddressList,"<ListOfAddresses>")

Returns:
   %_FirstAddress: first address from the list
   %_RemainingAddressList: address list without the first

^%-
%-
%_FirstAddress=""%-
%_RemainingAddressList=""%-
%If:'%_1'<>''%-
:'%setpattregexp=#^((?(?=")"[^"]*")[^;,]*)[;,\s]*(.*?)[;,\s]*$#%-
%regexpblindmatch="%_1"%-
%_FirstAddress=+%subpatt="1"+%-
%_RemainingAddressList=+%Subpatt="2"+'%-
:''%-
=====[ End ParseAddressList ]=====

And the fourth is "Get_Memo_Attribute"

====[ Start Get_Memo_Attribute" ]====
%Rem='

Usage:
   <attribute value>=%QInclude(Get_Memo_Attribute,"Tag","Default_Value")

This will return the value from a line in the address book memo field
that looks like this:
   <tag>value</tag>

Or the "Default_Value" if no such line exists

'%-
%If:'%SetPattRegExp="(?im)^<%_1"%RegExpMatch="%ABToMemo"'='':'%_2'%-
:'%If:+%SetPattRegExp="(?im)^(<%_1/>)"%RegExpMatch="%ABToMemo"+<>++:++%-
:+%SetPattRegExp="(?im)^(?:<%_1>)(.*?)(?:</%_1>)"%RegExpMatch="%ABToMemo"+'%-
=====[ End Get_Memo_Attribute ]=====

That's it.

Now create an email to an addressbook entry that has a secondary address in
the Memo field and it should automatically add it when you tab into the body
of the email.
-- 
Robin

Using The Bat! v4.1.11
      Windows XP 5.1 Build 2600 Service Pack 3
      Popfile v0.22.4



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

Reply via email to