At the company I work with, we use [client-domain.com]
prefixes before the actual subject line of emails as kind of a rough tagging system.
Is there any way that one could automate this so when I start writing a new email to johndoe@foobar.com
, the subject will be pre-populated by [foobar.com]
?
Answer
A quick and dirty AppleScript attempt to achieve what you want, but it certainly can be improved, i.e. being bound to Automator actions, based on selection from selected items in your address book.
To use this, open "AppleScript Editor" (it's in /Applications/Utilities/, or use Spotlight), paste the following as the text body and click "run". If it's OK, you can save the script and later run it by clicking on it.
set recipientList to display dialog "Enter the email address:" default answer ""
tell application "Mail"
set composeMessage to make new outgoing message at beginning with properties {visible:true}
tell composeMessage
set recipientList to (text returned of recipientList)
make new to recipient at end of to recipients with properties {address:recipientList}
set AppleScript's text item delimiters to "@"
set domain to text item 2 of recipientList
set subject to "[" & domain & "]"
end tell
end tell
Of course, this can be improved upon.
Also, you should know, as pointed out by Daniel Beck that the recipient is free to remove that field; it's best to rely on hidden mail headers. But given you already have the domain, this info is safely stored in the email recipient.
No comments:
Post a Comment