Skip to content

Instantly share code, notes, and snippets.

@theduderog
Created May 24, 2011 22:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theduderog/989911 to your computer and use it in GitHub Desktop.
Save theduderog/989911 to your computer and use it in GitHub Desktop.
MS Outlook for Mac - get rid of yourself in "Reply All"
tell application "Microsoft Outlook"
set myAlias to "your.email@foo.com"
set listMessages to selected objects
set theMessage to first item of listMessages
set outgoingMessage to reply to theMessage
set theSender to sender of outgoingMessage
set theSenderAddress to the address of theSender
set theSenderName to the name of theSender
set theToRecipients to every to recipient of theMessage
repeat with i from 1 to count theToRecipients
set theRecipient to item i of theToRecipients
set theEmailAddressElement to the email address of theRecipient
set theEmailAddressText to the address of theEmailAddressElement
try
set theEmailAddressName to the name of theEmailAddressElement
set newProperties to {email address:{address:theEmailAddressText, name:theEmailAddressName}}
on error
set newProperties to {email address:{address:theEmailAddressText}}
end try
if (not (theSenderName contains theEmailAddressText or theSenderAddress contains theEmailAddressText)) then
if theEmailAddressText does not contain myAlias then
tell outgoingMessage
make new to recipient with properties newProperties
end tell
end if
end if
end repeat
set theCcRecipients to every cc recipient of theMessage
repeat with i from 1 to count theCcRecipients
set theRecipient to item i of theCcRecipients
set theEmailAddressElement to the email address of theRecipient
set theEmailAddressText to the address of theEmailAddressElement
try
set theEmailAddressName to the name of theEmailAddressElement
set newProperties to {email address:{address:theEmailAddressText, name:theEmailAddressName}}
on error
set newProperties to {email address:{address:theEmailAddressText}}
end try
if (not (theSenderName contains theEmailAddressText or theSenderAddress contains theEmailAddressText)) then
if theEmailAddressText does not contain myAlias then
tell outgoingMessage
make new cc recipient with properties newProperties
end tell
end if
end if
end repeat
end tell
@theduderog
Copy link
Author

Minor enhancement to Kurt Partridge's answer on Quora

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment