Skip to content

Instantly share code, notes, and snippets.

@satyr
Created March 13, 2010 04:31
Show Gist options
  • Save satyr/331107 to your computer and use it in GitHub Desktop.
Save satyr/331107 to your computer and use it in GitHub Desktop.
mailto (for Thunderbird etc.)
CmdUtils.CreateCommand({
name: 'mailto',
argument: noun_arb_text,
execute: function({object: {text}}){
var {title, URL} = CmdUtils.getDocument();
Utils.currentChromeWindow.gBrowser.loadURIWithFlags(
'mailto:'+ encodeURIComponent(text) + Utils.paramsToString({
subject: "'"+ title +"'",
//body: URL +'\n\n'+ CmdUtils.getSelection(),
'html-body': ((<><a href={URL}>{URL}</a><br/><br/></>) +
CmdUtils.getHtmlSelection()),
}).slice(0, 2e3), // trim to avoid exception
'');
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment