Skip to content

Instantly share code, notes, and snippets.

@mikejoseph
Created July 9, 2018 13:58
Show Gist options
  • Select an option

  • Save mikejoseph/740afe29b7c12881df724fba6823bdd0 to your computer and use it in GitHub Desktop.

Select an option

Save mikejoseph/740afe29b7c12881df724fba6823bdd0 to your computer and use it in GitHub Desktop.
Applescript to send and flag your messages to Todoist
(* I use the Gray flag to note messages that that may need to be responded
or at least messages that have been forwarded to Todoist. Put your inbox address
in and your archive mailbox (it's probably just "Archive") and you're good to go.
Then you can create a smart mailbox for archived, Gray flagged messages to see what
needs to be responded to after completing the task *)
tell application "Mail"
set inboxAddress to ""
set archiveMailbox to ""
set theSelectedMessages to selection
repeat with theMessage in theSelectedMessages
set newMessage to forward theMessage
tell newMessage
make new to recipient with properties {address:inboxAddress}
set visible to true
end tell
send newMessage
set theAccount to account of mailbox of theMessage
tell theMessage
set flag index to 6
end tell
move theMessage to mailbox archiveMailbox of theAccount
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment