tell application "Mail"
set selectedMessages to selection
if (count of selectedMessages) is equal to 0 then
else
set theMessage to item 1 of selectedMessages
set theSubject to subject of theMessage
set theSender to sender of theMessage
set theMessageId to message id of theMessage
if theMessageId is "" then
display dialog "Can't link this message to Things!"
return
end if
set message_url to "[url=message:%3C" & ¬
theMessageId & ¬
"%3E]" & ¬
theSubject & ¬
"[/url]"
tell application "Things"
set newToDo to make new to do ¬
with properties {name:theSender & " : " & theSubject}
set newToDo's due date to current date
set newToDo's notes to message_url
end tell
end if
end tell