< Day Day Up > |
Don't embarrass yourself by sending private replies to everyone. Using any email program, it's all too easy to accidentally hit the Reply All button and end up saying something to a large group that was meant for just one person. But the problem isn't limited to the Reply All button. If there are multiple people in the To: list, it's even easier to accidentally reply to them all, because the Reply button replies to everyone by default. 7.3.1. The CodeThis user script runs in the Compose frame of Gmail, which can be identified by its query string parameter view=cv.
The script uses the following algorithm to detect a possible reply-all snafu:
Save the following user script as dontreplyall.user.js: // ==UserScript== // @name Don't Reply-All // @namespace http://youngpup.net/ // @description Warn before replying to multiple recipients in Gmail // @include http*://mail.google.com/mail/?*&view=cv* // ==/UserScript== // based on code by Aaron Boodman // and included here with his gracious permission var recipient_separator = /\s*\,\s*/g; document.addEventListener("click", function(e) { if (e.target.id == "send") { var form = document.getElementById("compose_form"); var to = removeEmptyItems( form.elements.namedItem('to').value.split(recipient_separator)); var cc = removeEmptyItems( form.elements.namedItem('cc').value.split(recipient_separator)); var bcc = removeEmptyItems( form.elements.namedItem('bcc').value.split(recipient_separator)); if ((to.length + cc.length + bcc.length) > 1) { if (!confirm("WARNING!\n" + "Do you really want to reply to all these people?\n\n" + "To: " + to.join(", ") + "\n" + "CC: " + cc.join(", ") + "\n" + "BCC: " + bcc.join(", "))) { e.stopPropagation(); } } } }, true); function removeEmptyItems(arr) { var result = []; for (var i = 0, item; item = arr[i]; i++) { if (/\S/.test(item)) { result.push(item); } } return result; } 7.3.2. Running the HackAfter installing the user script (Tools Install This User Script), log into Gmail at http://mail.google.com and open any message. Replace the To: field with multiple test addresses and press Send. The script will display a dialog to confirm that you want to send your message to multiple recipients, as shown in Figure 7-3. Figure 7-3. Confirmation message before replying to multiple recipientsIf you hit OK, Gmail will send the message as usual. If you hit Cancel, you will stay in the message composition window and can edit the To: or Cc: list to trim the number of recipients. Aaron Boodman |
< Day Day Up > |