Hey. I searched for a long while trying to find a single action way of forwarding emails to the OmniFocus inbox. I don’t know why, but there was just a little bit of resistance in having to Cmd-F the email, try to get the to field to auto-recognize the omnifocus forwarding address, and edit the subject as needed.
I finally just broke down and tried to write this myself. I’m terrible with AppleScript, so I’m sure there this can be improved.
Using Alfred I wrote a workflow that take a keyword (I used “fo”) with an optional argument. The keyword invokes the following Applescript:
on alfred_script(q)
set alfredSubject to q
tell application "Mail"
set messageThread to the selection
set theMessage to the last item of messageThread
set theAccount to the name of the account of the mailbox of theMessage
set newMessage to make new outgoing message at end of outgoing messages
tell newMessage
set content to (theMessage's content as Unicode text)
if alfredSubject is "" then
set subject to theMessage's subject
else
set subject to alfredSubject
end if
make new to recipient with properties {address:"myOmniFocusInbox@sync.omnigroup.com"}
end tell
move theMessage to mailbox "Archive" in account theAccount
send newMessage
end tell
end alfred_script
If there is no argument after the keyword, the email is forwarded using the existing subject. If there is an argument then it uses that argument as the subject.
Note that because of the threaded nature of messages in Mail.app, Applescript understands selected emails as a list. Since you have to select one, I selected the last, which if you accidentally select a message thread is usually the intended one.
Anyhow, it was driving me nuts that I couldn’t find this somewhere on the internet. Let me know if there is a better one that I just missed, or if not, are there are any suggested improvements to this one.