Pages: 1
RSS
Reseting the TO field, %TO works in mysterious ways
 
I have a QT that changed the TO header according some criteria. The critical line was something like:
%TO=""%TO="new@addre.ss"

It worked until 3.6x. Now it only clears the TO field and leaves it empty.

Ideas?
 
Use %SetHeader("To","myaddress")
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
 
Quote
Use %SetHeader("To","myaddress")
Is %SetHeader documented somewhere? When is it best to use the likes of %FROM, %REPLYTO and when is it best to use %SetHeader?

Regards, John M
 
It's documented in the help file.

%SetHeader can be used for all headers, in behaviour there is no difference between %SetHeader and %From or %ReplyTo. However, there is a difference between %SetHeader and %To. %To adds the new address to the To header, while %SetHeader replaces the old To header with the new contents. That behaviour of the %To macro made it necessary to use constructs like %To=""%To="address" in order to empty the To header first before adding the new contents. Due to changes in the macro translation that construct fails every now and then. In those cases %SetHeader is better.
%SetHeader also makes it possible to edit any header, as long as it is listed in Option/Preferences/Message Headers (and you can add your own headers there). So I can create an X-Roelof header (RFC 2822 states that you can use any custom made header as long as its name starts with X- ) and with SetHeader I can fill the contents with whatever you like. Like %SetHeader("X-Roelof","Roelof was here!")

So basically you can forget about all of those one header macros and always use %Setheader.
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
 
Quote
It's documented in the help file.
It's not listed in the index under Setheader which is the obvious starting point. I found it eventually using Search. Your explanation is very useful and much more comprehensive than the help file. Thanks.

Regards, John M
 
Actually, I never look in the index for macros. I always go for:
macros/full alphabetic listing of macros
Never occurred to me that you wouldn't start looking there.
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
Pages: 1