I am a beginner in thunderbird addons so I really appreciate if you can help me. I am trying to find a way in my background javascript to check whenever a user has opened the window for create a new message, reply a message and forward a message. I want to put a default text in the message window before the user is gonna send it. I know thunderbird 78+ should only uses web extension APIs and i found this Compose API but how to use it in my background script.
https://thunderbird-webextensions.readthedocs.io/en/78/compose.html
It looks like
setComposeDetails()is what you want.I have note tried it, but I suppose that either
details.bodyordetails.plainTextBodyfrom theComposeDetailsobject can be used to pass the default text you want to use. So I would try something like this in the background script:You might have to combine it with a call to
messages.getComposeDetails()if empty fields indetailsreset the values in the composer window (I don't know).If you want to call this when the user opens a new compose window, I would look at the
window.onCreatedevent. If you want to do it right before the message is sent instead, you should look at thecompose.onBeforeSendevent. All of them are described in the API documentation.