Pages: 1
RSS
Changing default templates, Looking for a way to avoid fixing every account one by one
 
I've just spent some time changing three templates (new message, reply, forward) on one email account.

But I have 55 accounts to deal with, and I don't want to have to make those changes 54 times more. Is there a way to change or specify the default template to make it apply to all accounts? Or to copy templates from one account to another?
 
As in my reply in your previous topic, this too can be done from the command line when creating accounts. For already created accounts, the /ADD command should actually modify them.
 
Thank you for your response. I have been using The Bat! since 2017 and I was totally unaware that it had a command-line interface. And today I discovered why. It is almost impossible to find in the documentation, unless you already know that it is there.

There is one important point the documentation does not cover. It says:
Quote
Template="value": The default new message template for this account stored in a file.
but it neglects to say anything about what the file should look like. My templates are in HTML.  What I would like to do is take an existing template, export it to a file, and point the /ADD command at that file. But if that is not possible, and I have to write one from scratch, I need to know at least a little about the CSS stylesheet that is being used.
Edited: Paul Keating - 12 November 2024 22:08:42
 
Quote
Paul Keating wrote:
but it neglects to say anything about what the file should look like. My templates are in HTML.  What I would like to do is take an existing template, export it to a file, and point the /ADD command at that file. But if that is not possible, and I have to write one from scratch, I need to know at least a little about the CSS stylesheet that is being used.

I have no idea.

But I did try something else - manually created a copy of a whole account. I made a new directory in the TB mail directory, copied all the contents from the account directory into it, and did Account -> New... -> Restore From... -> Home folder, pointing it to the newly created directory. The new account had the same name as the original one so I edited it in account properties. As far as I could see everything was preserved: folders, messages, filters... And yes, the message templates. Sending and receiving messages worked. But not virtual folders that operated on specific message folders, I had to specify the folders again. I did this for a POP3 account, my only IMAP account is for GMail and I don't want to mess with it.

So, you can consider taking this manual route. For mass copying/renaming Total Commander could do the job (or a batch script), and instead of Account -> New... -> Restore From... -> Home folder you could write a batch script to do the same using TB's /ADD command.
Edited: Miloš Radovanović - 15 November 2024 10:13:15 (can)
 
I think you'll have to try for yourself if HTML templates can be imported.

As for CSS, I don't understand the assumption that it is being used. A regular HTML email has all its HTML contained within a single attachment named message.html. CSS is not required, but if you want to use it, you'll have to use inline CSS.
I volunteer as a moderator to help keep the forum tidy. I do not work for Ritlabs SRL.
 
Quote
Miloš Radovanović wrote:
But I did try something else - manually created a copy of a whole account.

In an old discussion from 2007, power user Roelof Otten suggested copying just the account.flb file which contains the templates. This was also a pop3-only suggestion, and may be worth a try if all accounts have the same folder structure (and only after making a full backup!)
I volunteer as a moderator to help keep the forum tidy. I do not work for Ritlabs SRL.
 
Quote
I don't understand the assumption that [CSS] is being used.

It's not an assumption. I can see the HTML in a hex dump of the account.qtb file.
 
Quote
Paul Keating wrote:
Quote
I don't understand the assumption that [CSS] is being used.
It's not an assumption. I can see the HTML in a hex dump of the account.qtb file.

Well, send yourself a HTML message using one of your templates and when you receive it, view the message.html attachment in a text editor (or load it into a browser and view the source). If any inline CSS is used, you'll see it there in plain text. If any external CSS should be used, which I'd find extremely unlikely because many email clients don't support it, then you'll find the references there as well.

As for account.qtb, I don't think it contains regular templates, just quick templates.
I volunteer as a moderator to help keep the forum tidy. I do not work for Ritlabs SRL.
 
Quote
Daniel van Rooijen wrote:
As for account.qtb, I don't think it contains regular templates, just quick templates.

Yes, message templates seem to be in Account.CFN.
 
After having spent an unreasonable amount of time parsing the .qtb and .cfn files to extract the templates, and learning in the process entirely too much about the way they store versions and encodings, I discover that the proper way to do what I want is: open the template of interest in the editor, ensure that Format | HTML is selected, then press F9 to get the HTML source code editor.

From there you can copy and paste the template into a file and use the command line option /ADD to attach that file to another account. To my amazement, that gets correctly interpreted as an html template and not as plain text.

And if anyone reading this is prompted to exclaim Oh, but that is obvious, then it might be well to remember that it is generous to explain things to a puzzled beginner, however obvious they might seem to you.

This has also led to a useful discovery. I had thought that The Bat!'s infuriating habit of switching to monospace whenever you add a linebreak into the middle of a message was a bug in the editor. But it isn't. It's because the standard CSS prologue, that you normally can't see, sets all instances of <p> to 9-point Consolas. And when you put a new blank line in the middle of a paragraph, the editor (of course) provides a <p> tag for it.

The Bat! silently supplies this CSS in an html <head> tag for every template. I think what the CSS specifies is, to be polite, retro, with everything monospace except the signature. Now we can all agree that that is a matter of taste. But since it is a matter of taste, it ought to be possible to permanently set it to something else, rather than having to override it in every template.

And it would be nice to know (without having to work it out by trial and error) under what circumstances the template processor invokes the tags
  • <blockquote class="rt">
  • <blockquote class="email-signature">
  • <p class="email-signature"> (and what makes it different from <blockquote>?)
  • <PRE class="RFCHeader">
  • <A class="quote-odd">
  • <A class="quote-even">
  • <A class="quote-text-odd">
  • <A class="quote-text-even">
But experience suggests not to even bother to ask, so I won't.
 
Thank you for the feedback and all the insight Paul.

(Yes, many things are "obvious" in hindsight.)
 
Quote
Paul Keating wrote:
ought to be possible to permanently set it to something else, rather than having to override it in every template

Just occurred to me - I think it may be possible using profiles: Preferences -> Viewer/Editor -> Profile Layout. There you can set fonts, font sizes, etc. for many different "items" (regular text, hyperlinks...).

Doing this for the default <Generic Profile> could do the trick since the same editor is used for message templates and messages themselves.

In Preferences -> Viewer/Editor -> Viewer/Editor Profiles you can declare additional profiles which are triggered for specified character sets.
 
Thank you. That suggestion was very helpful. And it is in fact the only way to approach the problem, because the CSS styles in a template can't be changed by editing the html and saving the template. When you do that, The Bat! strips out everything you have put in the </head> tag and restores its own generated CSS.
Pages: 1