const DEFAULTS = {   internalDomains: ["yourcompany.com"],   recipientThreshold: 50, }; function getConfig() {   // … retrieve the internalDomains and recipientThreshold   //   settings from the Office “roaming settings” or   //   use the DEFAULTs if not available … } function isInternal(emailAddress, internalDomains) {   // return true if the email address is from one of the internal domains } function getRecipients(field) {   // field is “to”, “cc” or “bcc”   // use getAsync() to retrieve the content of that field } async function onMessageSend(event) {  try {   const config = getConfig() ;   const email = Office.context.mailbox.item ;    const [toRecipients, ccRecipients] = await(Promise.all([     getRecipients(item.to), getRecipients(item.cc)]) ;   const allRecipients = toRecipients.concat(ccRecipients);   const externalRecipients = allRecepients.filter(     (r) -> !isInternal(r.emailAddress, config.internalDomains));   if (exteralRecipients.length > config.recipientThreshold) {     const userMessage = “... warning message for user ...” ;     event.completed({       allowEvent: false,       errorMessage: message,       sendModeOverride: Office.MailboxEnums.SendModeOverride.PromptUser,     }) ;   } else {     Event.completed({allowEvent: true});   }  } catch(error) {    console.log(“error message”) ;    event.completed({allowEvent: true});  } }