RealRaven2000 / SmartTemplates

Thunderbird Add-on: SmartTemplates
http://smarttemplates.quickfolders.org/
Other
25 stars 15 forks source link

When sending email with unresolved from / recipient / to variables are not replaced automatically #284

Closed RealRaven2000 closed 3 months ago

RealRaven2000 commented 3 months ago

When we send off an email that has been written using "Write" (not reply / forward) it can contain clickable fields for headers like to (recipient) from and subject. These can be updated by clicking or completely replaced via the "Clean Up!" button on the Composer toolbar. This clean up routine is also automatically executed when the user clicks the "Send" button. however although this is replacing the variables with the data (as expected) on the sender's side, the recipient receives a version of the email that was saved before the button was clicked.

image

Clicking Send:

image

So SmartTemplates makes it look like the variables have been resolved (replaced) but they really haven't and were sent off unchanged. The expected behavior is to replace everything automatically, then save the draft of the modified (resolved) email and then asending off the modified version.

RealRaven2000 commented 3 months ago

Here is a first test version which uses the API event compose.onBeforeSend to trigger replacements. It seems to work reasonably well, except if you are also using the Cardbook Add-on and address lookup which seems to trigger the send event early (email is sent before ST gets a chance to replace everything)

smartTemplate-fx-4.4.2pre10.zip


To install version above download zip file and drag the file into Thunderbird Add-ons Manager (do not extract contents, it won't install like that)

RealRaven2000 commented 3 months ago

Here is a more reliable version, this uses an experiment API which calls the a function that calls SmartTemplate4.Util.cleanupDeferredFields() asynchronously and doesn't return until everything is replaced. The previous versions used a windows event handler that didn't properly wait for the function.

All my test worked correctly and replaced quite a large number of fields successfully before sending off the email/

smartTemplate-fx-4.4.3pre39.zip


To install version above download zip file and drag the file into Thunderbird Add-ons Manager (do not extract contents, it won't install like that)

RealRaven2000 commented 3 months ago

Fixed in 4.4.3 released on 15/04/2024