Skip to content

Instantly share code, notes, and snippets.

@RazorAnt
Created October 15, 2013 14:37
Show Gist options
  • Save RazorAnt/6992563 to your computer and use it in GitHub Desktop.
Save RazorAnt/6992563 to your computer and use it in GitHub Desktop.
Airmail script for ProfitTrain
-- The following is an AppleScript function ProfitTrain will call when you choose "Email Client..."
-- under an invoice. Before using the built in AppleScript ProfitTrain will look for
-- this user AppleScript file at:
-- /Users/[you]/Library/Application Support/ProfitTrain/email_invoice_using_user_script.scpt
-- By edting this file you can further customize the email with different subject lines, etc.
-- and/or use an alternative email client that is not supported by Billable by default.
-- Script using Airmail
on mail_invoice(subject_line, to_name, to_address, attachment_path)
-- Alert to show us which script is being called.
-- Feel free to comment out when you are done editing.
--display alert ("This is the user script and is editable in the Application Support folder of ProfitTrain.")
tell application "AirMail"
activate
set attachmentfilename to (POSIX file attachment_path) as string
set theMessage to make new outgoing message with properties {subject:subject_line, content:"Your invoice is attached."}
tell theMessage
--set sender to "me@example.com"
--set signature to "Default"
make new to recipient at end of to recipients with properties {name:to_name, address:to_address}
--make new cc recipient at end of cc recipients with properties {name:"Lara", address:"cc@example.com"}
--make new bcc recipient at end of bcc recipients with properties {name:"Mark", address:"bbc@example.com"}
make new mail attachment with properties {filename:attachmentfilename as alias}
compose
end tell
end tell
end mail_invoice
@dustinfarris
Copy link

Thanks for this. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment