Title: Re: AppleScripting outgoing messages
On or near 7/1/02 9:36 AM, Rick Johnson at [EMAIL PROTECTED] observed:

> I've finished an AppleScript that draws information from an email from my
> credit card service (Kagi) and sends it to a REALbasic app I wrote to
> generate registration codes for my shareware programs. It would be great if
> I could now script the creation of new emails (drafts), specifying the
> recipient's email address, subject, message body, and account. I'm sure it's
> simple, but finding an example is proving more difficult than I'd expected.
> Do you have any suggestions?
>
You may find most of what you want in this:

-- New Message to non-default Account
-- By Allen Watson
property defaultAccount : "Me at the Circle"
property favContacts : {"acimwkbk Lessons & Discussion", "Lessons Only MailingList", "COA ACIMWKBK", "COA ACIMLESSONS", "Mary Anne Buchowski", "James Gregory", "Greg & Margery Mackie", "Robert Perry", "Susan Perry", "Portland Text Class", "Diane Ross", "Ben Watson", "Phil Watson"}

tell application "Microsoft Entourage"
    activate
    set acctList to name of every POP account
    if acctList does not contain defaultAccount then set defaultAccount to "Main"
    set toUse to (choose from list acctList with prompt ¬
        "Which account do you want to use?" default items {defaultAccount} without multiple selections allowed)
    set toUse to item 1 of toUse
    set toWhom to (choose from list favContacts with prompt ¬
        "Send to whom?" default items {"Robert Perry"} with multiple selections allowed)
    -- Build recipient list
    set rList to {}
    repeat with r in toWhom
        try
            set c to contact (r as text)
        on error
            display dialog "Oops! You must have misspelled " & r
        end try
        set rList to rList & ("\"" & display name of c & "\" " & default email address of c)
        set useSig to (r contains "Lesson")
    end repeat
    if useSig then
        set sig to signature "Lesson Trailer"
    else
        set sig to signature "Standard"
    end if
    set newmsg to make new draft window with properties {recipient:rList, account:(POP account toUse), signature type:other, other signature choice:sig}
    
end tell
--
My web page: <http://home.earthlink.net/~allenwatson/>
My scripts page: <http:homepage.mac.com/allenwatson>
Microsoft MVP for Mac Entourage/Word--<[EMAIL PROTECTED]>

Reply via email to