Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
RealRaven2000 opened this issue Apr 2, 2024 · 3 comments
Assignees
Labels

Comments

@RealRaven2000
Copy link
Owner

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 RealRaven2000 self-assigned this Apr 2, 2024
@RealRaven2000
Copy link
Owner Author

RealRaven2000 commented Apr 2, 2024

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
Copy link
Owner Author

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 added a commit that referenced this issue Apr 11, 2024
beforeSend tidy up - replaced notification listener with an experiment function
@RealRaven2000
Copy link
Owner Author

Fixed in 4.4.3 released on 15/04/2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant