rock'n roll

May 29

AppleScript with Sparrow

Currently, Sparrow only supports sending emails using AppleScript. Other scripting features will be added in further versions.

Here, how you can send an email with Sparrow using AppleScript:


tell application "Sparrow"
    activate
    set theMessage to make new outgoing message with properties {subject:"meeting at 4:00", content:"We'll be 4 to discuss about the future of our life."}
    tell theMessage
         make new to recipient at end of to recipients with properties {name:"John Doe", address:"john@gmail.com"}
         make new to recipient at end of cc recipients with properties {name:"Sonia Jones", address:"sonia@gmail.com"}
         sendmessage
    end tell
end tell

If you want to review the email before you send it:


tell application "Sparrow"
    activate
    set theMessage to make new outgoing message with properties {subject:"meeting at 4:00", content:"We'll be 4 to discuss about the future of our life."}
    tell theMessage
         make new to recipient at end of to recipients with properties {name:"John Doe", address:"john@gmail.com"}
         make new to recipient at end of cc recipients with properties {name:"Sonia Jones", address:"sonia@gmail.com"}
         compose
    end tell
end tell

If you want to add an attachment, here how you can do that:


tell application "Sparrow"
    activate
    set filename:attachmentfilename to (POSIX file "/path/to/filename") as string
    set theMessage to make new outgoing message with properties {subject:"meeting at 4:00", content:"We'll be 4 to discuss about the future of our life."}
    tell theMessage
         make new to recipient at end of to recipients with properties {name:"John Doe", address:"john@gmail.com"}
         make new to recipient at end of cc recipients with properties {name:"Sonia Jones", address:"sonia@gmail.com"}
         make new mail attachment with properties {filename:attachmentfilename as alias}
         sendmessage
    end tell
end tell


  1. q1x reblogged this from dinhviethoa
  2. blisse-roberts reblogged this from dinhviethoa
  3. hirokin reblogged this from dinhviethoa
  4. raulete reblogged this from dinhviethoa
  5. dinhviethoa posted this