Skip to content

gruemme/tb-api-compose_message_headers

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 

Compose Message Headers - Experimental Webextention API for Thunderbird

Experimental webextention api to modify message headers

There are the following functions:

  • browser.composeMessageHeaders.addComposeHeader(tabId, headerName, headerValue) Sets the header with name headerName with the value headerValue in the message inside the tabId
  • browser.composeMessageHeaders.deleteComposeHeader(tabId, headerName) Deletes the headerline of header with name headerName in the message inside the tabId

Example usage:

function setMyHeaderValue( event, tabId ) {
    if(event.target.value) {
      console.log('Set myheader header to: ' + event.target.value);
      browser.composeMessageHeaders.addComposeHeader(tabId, 'X-MYHEADER', event.target.value);
    } else {
      console.log('Remove myheader');
      browser.composeMessageHeaders.deleteComposeHeader(tabId, 'X-MYHEADER');
    }

    return false;
};


// Set onchange to a select in popup.html with id `input-headerid`
browser.tabs.query({
  active: true,
  currentWindow: true,
}).then(tabs => {
  let tabId = tabs[0].id;
  let input = document.getElementById("input-headerid");
  input.addEventListener("change", () => setMyHeaderValue(event, tabId)) ;
});

About

Experimental webextention api to modify message headers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published