Select Account
Summary: Set the account for sending a message.
Requires: Apple Mail
Install Location: ~/Library/Scripts/Applications/Mail/
Last Modified: 2019-10-02
Description
It used to be possible to use the Keyboard pane in System Preferences to assign shortcuts for the items in “From” pop-up menu in Mail’s “New Message” window. This was helpful for quickly switching accounts, especially if you have defined a lot of aliases. As of Mac OS X 10.11.2, these shortcuts are not always available. You can instead use this script to select a particular account and assign a keyboard shortcut to the script.
You will need to fill in your first and last name and e-mail address.
Installation Instructions · Download in Compiled Format · Download in Text Format
Script
tell application "System Events"
tell application process "Mail"
activate
tell window 1
set _button to pop up button "From:"
click _button
tell menu of _button
click menu item "First Last – username@domain.com"
end tell
end tell
set frontmost to true -- Otherwise window will not be activated.
end tell
end tell