Closed orcofthedarkness closed 6 months ago
Could be a compatibility bug in Cardbook That you get a result without license suggests that the data was retrieved from the standard AB instead. Do you see any error messages in the error console (open with Ctrl_Shift+J) when you lload the template?
yes, i get the following 2 messages, when i click on the clickable variable
Ok. could you export one contact for me for testing please? Please send to thunderbirddaily@gmail.com, please reference [SmartTemplates] issue 246 in the subject line, if you want to send it off Github.
Also, I while testing I discovered a bad issue #247 that breaks the templates file in all versions of SmartTemplates 4.0, so don't try to add templates to the menu until that is fixed (is going to go into the next beta with high priority)
Thanks for sending test data - I couldn't reproduce the particular p[roblem (TypRror: nodeList is undefined), I got partial data back but didn't get the data for "other1, other2":
It looks like in my previous test versions I would have expected a array member looking like this:
"VALUE:some string"
but we see this data in card.others (information partially redacted):
card.others
Array [ "X-CUSTOM1:WolfgangR***********r", "X-CUSTOM2:r*******w" ]
0: "X-CUSTOM1:WolfgangR*******"
1: "X-CUSTOM2:r*******w"
length: 2
Below is a test template for all Cardbook / Addressbook fields
The error of nodeList = null seems to point to the way you are using the field. Interactively? from a plain text message? If the account template contains the address book fields, can you please export your smartTemplates account templates : too?
(this includes all the data on the left side of the dialog for the selected account)
Here is the exported account json Ronald.zip
Below is a test template for all Cardbook / Addressbook fields
now it gets weird. I installed the attached pre273 version from https://github.com/RealRaven2000/SmartTemplates/issues/247 When i import the templates from the "Address-Book-test.zip" as HTML template: Write - the correct data is pulled from the AB When i import the templates as Smart Snippet, it doesnt work any longer, no data will be pulled from the AB
Below is a test template for all Cardbook / Addressbook fields Address-Book-tests.zip
now it gets weird. I installed the attached pre273 version from #247 When i import the templates from the "Address-Book-test.zip" as HTML template: Write - the correct data is pulled from the AB When i import the templates as Smart Snippet, it doesnt work any longer, no data will be pulled from the AB
great that helps. I am inserting HTML elements into the document and they are later resolved in form of a list. Maybe that fails with a document that's pulled from the smartTemplate menu. For more info in error console, please install the version below
smartTemplate-fx-4.0pre274.zip
this will avoid the nodeList problem but not do anything immediately (e.g. try to insert text into the Editor immediately). I need to test first, but it should advance us a little...
installed pre274, used my template as a template for new mail
1) write new email -> template is used in msg body 2) fill in receipient in TO field 3) click on the clickable variables (one is working, on is not (see above)
Heres the output:
Personally, I wouldn't ever use %to%
(or %from%
) in a snippet. Because it is not clear who that is. The to from the original email that you reply to or the to you are now writing to?
instead, use either %recipient()%
(for whoever you are sending the email to) or %identity()%
representing the sender of this email (your from identity). To and from are very confusing to use for the text of the template, but are ok to use within quote header.
try this instead:
<p>Hi %recipient(firstname)%<br /><br />
Dein User: %recipient(addressbook,name,other.custom1,other.custom2)%
</p>
Personally, I wouldn't ever use
%to%
(or%from%
) in a snippet. Because it is not clear who that is. The to from the original email that you reply to or the to you are now writing to?
yes, that makes sense. thanks. changed it to your suggested version but still...no luck :( template used as template for a new email (and click ond the clickable variables)
template used as smart snippet: doesnt work at all
By the way, testing with Thunderbird 102, here is what I get returned from a custom1 field:
the first line is the label of the custom property "custom 1!", the second line is the contained data "C1". That's why I was looking for "VALUE:(some data)". So I need to check why your data is not formatted that way ... hope it is not vCard version dependant, I based it on the format that Phillipe V (the owner of the Cardbook Add-on) returned at the time I implemented the communication between ST and CB
I am still down the rabbit hole of testing. it seems there are some "mixed up perspective" problems still when it tries to get the header variables. The function classifyReservedWord(..)
in this case uses lookup list TokenMap["recipient"]
and that returns "to"
... which is correct, but the "hdr" is filled with the header information of the original mail (the one I reply to). I wonder if this is an artifact of using the addressbook lookup during a fragment, I still have to wrap my head around that.
Ok I made some unfortunate finding what happens when we use the fragment in a reply. For %recipient%
it doesn't use the current value from the "to" address but the "from" of the original email header. So if we change the addressee by typing a completely different recipient in the "to:" address this will be ignored and still retrieve data from the original sender. I guess I need to look very hard whether I can either swap out the "hdr" structure to reflect data from the current document once the fragments are used, or not replace the "recipient" keywords until much later. Depending on what is easier; this is complicated stuff right there...
I dealt with the %recipient%
problem, at least it works in fragments now. I will very likely raise a separate bug to explain it. Here is a version for testing:
smartTemplate-fx-4.0pre277.zip
the upshot is that you can now edit the addresse and change the "To:" and the fragments will pick up the correct address items via %recipient()%
.
I dealt with the
%recipient%
problem, at least it works in fragments now. I will very likely raise a separate bug to explain it. Here is a version for testing:
tested, looks good to me (re-populate the clickable variables after changing the receipient in TO: field)
one more thing (not related to the pre277 version): if i use the html template as snipplet, i cannot populate cthe clickable variables. if i use the very same template in a "new e-mail", it works as expected:
here you can see, that its the same template (i dont have a template in "write email":
if i use the html template as snipplet, i cannot populate the clickable variables.
Sorry I don't understand that sentence, can you give an example?
Do you mean the "deferred" variables that turn up when you write a new email using fields like %recipient(name)% ?
... hmm looks like inserting a fragment via "open template file..." directly is broken, I will raise a separate bug. see #249
if i use the html template as snipplet, i cannot populate the clickable variables.
Sorry I don't understand that sentence, can you give an example?
Do you mean the "deferred" variables that turn up when you write a new email using fields like %recipient(name)% ?
sorry...my bad. my text was little confusing. My template starts like this:
<p>Hi %recipient(firstname)%,<br /><br />Dein User: %recipient(addressbook,name,other.custom1)%</br>Dein Passwort: %clipboard%</p>
if i insert this template via
and click on the first "To - button" (next to "Hi") in the msg body, nothing happens at all.
if i insert the very same template via
a click on the first "To - button" (next to "Hi") works indeed
I am not sure if I can make the script commands work from a "Fragments" entry - did this use to work in Thunderbird 102? There may also be some fallout from the changes (fixes) to %recipient%. I mainly use the "insert snippet" menu for extracting information from the original mail or adding some FAQ / Layout elements, nothing too heavy that interacts with the address headers ....
I made a new version over at:
https://github.com/RealRaven2000/SmartTemplates/issues/249#issuecomment-1642668168
Are there any errors in javascript error console? (use the right-click menu to copy all messages, no screenshots please)
Since we closed #249 can we close this one as well? I am not sure if there any open issues... if it still is a problem, simply reopen this one and send the error log...
I am just revisiting this bug to make sure it is fixed - I don't know where I can edit the "custom" values in the CardBook editor, any ideas?
I am just revisiting this bug to make sure it is fixed - I don't know where I can edit the "custom" values in the CardBook editor, any ideas?
I think I managed it in cardbook settings under Custom fields, I set up this:
Then I made a new version which makes sure to use the correct email when using the variables %recipient%
and %identity%
even from a smart fragment menu and used the following fragment for testing:
<div style="border: 1px solid gray; padding: 0.5em; margin-block: 0.5em; border-radius: 5px;">
<h3>test cardbook <i>other.custom</i>:</h3>
Recipient: %recipient(addressbook,name)%<br>
[[C1: %recipient(addressbook,other.custom1)%<br>]]
[[Shoe Size: %recipient(addressbook,other.custom2)%<br>]]
[[YouTuber: %recipient(addressbook,other.custom3)%<br>]]
[[Support: %recipient(addressbook,other.custom4)%<br>]]
</div>
The results looked correct to me - test version below:
To test the version above, download the zip file and drag the file into Thunderbird Add-ons Manager without extracting contents.
Implemented in 4.4 - published 28/03/2024
Hi,
TB version: 115.0 SmartTemplates version: 4.0pre256 Cardbook version: 90.4
Here is the content of my template (it doesn't matter "which" template (write, reply, forward...)
<p>Hi %to(firstname)%<br /><br />Dein User: %to(addressbook,other.custom1)%</p>
When you have NO license applied, both the %to(firstname)% and the %to(addressbook,other.custom1)% are working just fine. Once you apply the (valid) license (all PRO features are enabled), the %to(firstname)% still works, but %to(addressbook,other.custom1)% doesn't work anymore. If you remove the license key, everything work as expected.
Tested also with other.custom[2-4].
thx in advance, Ron