Pages: 1
RSS
A reply template which selects the correct identity, Just two problems...can they be solved?
 
I think I've finally figured out how to use identities, after searching the forum. But there's one thing I'm missing, and I don't know if it's possible in The Bat or, if so, how to do it.

I have several email accounts which forward to one, and The Bat downloads that one, filtering messages into various folders according to topic or list, and leaving the remaining messages in the account's Inbox. In the account's properties I filled in the name & email address I use most often. For my other email addresses, I set up quick templates (all under the one account) which look something like this:

Code
%FROM="My Name <this@emailaddress.com>"%-



Generally, if I reply to a message, I want the reply to be sent "from" the same email address to which the original message was sent. I can't achieve this using folder identities, because I don't separate my incoming mail by which email address it was sent to. So I set up the Reply template in my main account like this:

Code
%FROM="My Name <%OTOADDR>"%-
%Cursor
On %ODateEn, %OTimeLongEn, you wrote:
%Quotes


This looks at the recipient address of the message I'm replying to, and inserts that email address into the appropriate place in the From field of the new message. That works great most of the time, but there are two exceptions.

One, which I don't quite understand, is that if the message I'm replying to is in a common folder, rather than in one of my account folders, it just fills in my default email address, rather than the original message's recipient address, as indicated by %OTOADDR. I have the same Reply template for the Common Folders "account" preferences as for my main account.

The other puzzle, which is predictable but I wonder if there's a workaround, is that if I reply to a message which appears to be sent to someone else (for example one which is Bcc'd to me), my reply template will cause that someone else's email address to be placed in the From field with my name, which I certainly don't want. What I'd like The Bat to do is, if %OTOADDR does not match one of several email addresses (mine), to just use my default email address instead. Is this possible? It would seem to need only a conditional statement, but I don't know if The Bat allows something like that.

Thanks in advance for any help/guidance.
 
You can use conditions in macros with the %if macro. See the help for more instructions.

__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
 
Thanks for the tip. However, I'm still having problems.

I tried a bunch of embedded conditionals, very carefully checking the syntax, and I wound up with garbage. Then I discovered variables and regular expressions, which should make it easier. But I don't understand why the following Reply template doesn't work:

Code
%MyEmailAddresses="%REGEXPTEXT='one@example.com|two@example.com|three@sample.com'"
%MyFromAddress='%IF:"%OTOADDR"="%MyEmailAddresses":%OTOADDR:"one@example.com"'
%FROM="My Name <%MyFromAddress>"%-
%Cursor
On %ODateEn, %OTimeLongEn, you wrote:
%Quotes


[I don't know why it puts linebreaks in funny places and hyphenates across the linebreaks; it doesn't look that way when I edit this post.]

I would expect the From field of a reply to look like:

My Name <one@example.com>
or
My Name <two@example.com>
or
My Name <three@sample.com

but invariably it looks like:

My Name <>

I tried substituting all the text to avoid using variables, but then I ended up with garbage again.

What I am missing?
 
Variables should stat with %_ and not with a single %
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
 
Thanks again for the tip.

Here's how I finally implemented it. Regular expressions got too confusing, so I went back to conditoinals. I had been making it too complicated the first time I tried this, thinking that to embed conditionals I'd need to quote each embedded conditional; that turned out to be not only frustrating but unnecessary. In other words, I found I could do:

%IF:'%ABC'='good':'%ABC':'okay'

and that to extend that, I could do:

%IF:'%ABC'='good':'%ABC':%IF:'%ABC':'very good':'%ABC':'okay'

or further:

%IF:'%ABC'='good':'%ABC':%IF:'%ABC':'very good':'%ABC':%IF:'%ABC'='excellent':'%ABC':'okay'

and so on. The new %IF statements don't themselves need to be quoted in order to be embedded in the already-begun %IF statements.

What I actually did looked something more like this, and could easily be modified by someone wishing to do what I wanted to do, namely to have your message replies sent 'from' whatever email address the original message was addressed to, unless it wasn't addressed to one of your email addresses, in which case your message reply is sent 'from' a default email address of your choice (which would be the last email address in the example below):

%FROM=
"Joe Smith <
  %IF:'%OTOADDR'='js@joesmith.com':'%OTOADDR':
  %IF:'%OTOADDR'='jsmith@joesmith.com':'%OTOADDR':
  %IF:'%OTOADDR'='jsmith@rit.edu':'%OTOADDR':
  %IF:'%OTOADDR'='joe.smith@gmail.com':'%OTOADDR':
  %IF:'%OTOADDR'='webmaster@joesmith.com':'%OTOADDR':'joe@joesmith.com'
  >"
%-

(All of the above should be on one line; I added linebreaks here to improve readability and prevent this stupid forum software from breaking it up and hyphenating it.)
 
I just realized, of my original two problems, only the second one was resolved. The first persists.

Quote
if the message I'm replying to is in a common folder, rather than in one of my account folders, it just fills in my default email address, rather than the original message's recipient address, as indicated by %OTOADDR [or the conditional statement]. I have [still] the same Reply template for the Common Folders "account" preferences as for my main account.

Any ideas?
 
I don't use common folders, so I can't really test your problem, but what happens when you set the folder templates for your common folders and not the 'account' template?
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
 
Actually, now it's working -- although no matter what common folder I'm in, it uses my account's reply template, not the reply template set in Common Folders Preferences (which dialog I open by selecting Account > Properties when any common folder is selected), or the (same) reply template which appears in the Properties dialog for any common folder.

These templates were identical (when I posted my first message in this thread, and again when I posted the previous one), but then I made an insignificant tweak to the account's reply template. That's when I noticed that that template, not the common folders' reply template, was being used when I replied to a message in a common folder. (This doesn't seem right. Is it a bug or a feature?) That's also when the first problem I complained of in my original post (and again in my last post, after getting the templates right) mysteriously went away, so that now it obeys the macro statement in my reply template, rather than just filling in the default address.

I could have been imagining it both times, but I thought I tested it pretty carefully, replying to messages addressed to my alternate email addresses as well as messages addressed to my default one, and observing my default address being filled into the From field for my reply every time.
Pages: 1