Skip to content

Instantly share code, notes, and snippets.

@genegoykhman
Created January 11, 2013 21:26
Show Gist options
  • Save genegoykhman/4514089 to your computer and use it in GitHub Desktop.
Save genegoykhman/4514089 to your computer and use it in GitHub Desktop.
Modified create_mail routine in Mail.scpt of the QuickSilver Apple Mail support plugin that includes mail signatures in new messages you create. The first signature with the name "Default" or "Quicksilver" is used.
on create_mail(theSubject, theBody, theSender, theRecipients, thePaths)
tell application "Mail"
set theMessage to (make new outgoing message at the beginning of outgoing messages with properties {subject:theSubject, content:theBody})
repeat with i from (count of theRecipients) to 1 by -1
tell theMessage to make new to recipient at beginning of to recipients with properties {address:(item i of theRecipients)}
end repeat
if (theSender is not missing value) then set sender of theMessage to theSender
end tell
if (thePaths is not missing value) then
set theAliases to my aliasesForPaths(thePaths)
tell application "Mail"
tell content of theMessage
repeat with theAlias in theAliases
make new attachment with properties {file name:theAlias} at after the last word of the the last paragraph
end repeat
end tell
end tell
end if
tell application "Mail"
repeat with theSignature in signatures
if name of theSignature is "Default" or name of theSignature is "Quicksilver" then
set message signature of theMessage to theSignature
exit repeat
end if
end repeat
end tell
return theMessage
end create_mail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment