Skip to content

Instantly share code, notes, and snippets.

@lak
Last active October 22, 2016 14:16
Show Gist options
  • Save lak/24483719cd4d75f91999 to your computer and use it in GitHub Desktop.
Save lak/24483719cd4d75f91999 to your computer and use it in GitHub Desktop.
A simple (and lame) script for forwarding an email to Trello, and including a URL for the message ID of the message. This makes it so you can click on the URL in trello and have the original email opened up in Mail.
on log_err(message)
display notification message
log message
end log_err
on run
try
tell application "Mail"
set theAddress to "<email>@boards.trello.com"
set messageURL to ""
set messageContent to ""
set theSelection to selection
set theMessage to item 1 of theSelection
set messageURL to ("message://%3c" & theMessage's message id & "%3e")
set messageText to (content of theMessage)
set messageSubject to subject of theMessage
set myMessage to make new outgoing message with properties {content:messageURL & return & return & messageText, subject:messageSubject, visible:true}
tell myMessage to make new to recipient with properties {address:theAddress}
activate
-- I'd like to delete the message, but it seems to cause a 10s freeze in the app
-- delete theMessage
end tell
on error errmsg
my log_err("Could not forward message: " & errmsg)
end try
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment