on perform_mail_action(info) tell application "Mail" set the_messages to |SelectedMessages| of info repeat with a_message in the_messages set the_subject to (content of header "subject" of a_message) as text set the_content to (content of a_message) as text if the_subject begins with "blast" then set {astid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, " "} set blastString to text items 2 thru (count of text items of the_subject) of the_subject as text set AppleScript's text item delimiters to astid tell application "MoodBlast" to blast blastString end if end repeat end tell end perform_mail_action