Skip to content

Script: AddRecipients

SamuelPlentz edited this page Jul 2, 2022 · 4 revisions

Add recipients to the mail. (similar to [[HEADER|to|test@example.com]]) A type could be specified to add recipients to the to, cc, bcc, reply-to area.

Script (Thunderbird 102 or newer)

let type = this.mVariables[0];
let adresses = this.mVariables[1].split(';');

var win = this.mWindow;

if(type == "to") {
  let toRow = win.document.getElementById("addressRowTo");
  win.addressRowAddRecipientsArray(toRow, adresses, true);
}

if(type == "cc") {
  let ccRow = win.document.getElementById("addressRowCc");
  win.addressRowAddRecipientsArray(ccRow, adresses, true);
}

if(type == "bcc") {
  let bccRow = win.document.getElementById("addressRowBcc");
  win.addressRowAddRecipientsArray(bccRow, adresses, true);
}

if(type == "reply-to") {
  let replyRow = win.document.getElementById("addressRowReply");
  win.addressRowAddRecipientsArray(replyRow, adresses, true);
}

Script (Thunderbird 91 or older)

let type = this.mVariables[0];
let adresses = this.mVariables[1].split(';');

var win = this.mWindow;

if(type == "to") {
  win.awAddRecipientsArray("addr_to", adresses);
}

if(type == "cc") {
  win.awAddRecipientsArray("addr_cc", adresses);
}

if(type == "bcc") {
  win.awAddRecipientsArray("addr_bcc", adresses);
}

if(type == "reply-to") {
  win.awAddRecipientsArray("addr_reply", adresses);
}

Usage

Add recipients to to:

[[SCRIPT=AddRecipients|to|John Doe <john.doe@example.com>;Jane Doe <jane.doe@example.com>;test@example.com]]

Add recipients to cc, bcc and reply-to:

[[SCRIPT=AddRecipients|cc|John Doe <john.doe@example.com>]]
[[SCRIPT=AddRecipients|bcc|Jane Doe <jane.doe@example.com>]]
[[SCRIPT=AddRecipients|reply-to|test@example.com]]