Title: Re: AppleScript to specify mail account
On 5/29/01 5:44 AM, "Rick Johnson" <[EMAIL PROTECTED]> wrote:
> Is it a simple matter to write an AppleScript that instructs Entourage to
> create a message specifying a specific one of several mail accounts? I've
> seen some available for download, but they're user-configurable and thus too
> advanced (complex) for me to understand. I'd like to make a single-purpose
> script that I can execute from a REALbasic application to have Entourage
> create a boilerplate message from an account which is not my default
> account. Essentially, something like this, only with correct syntax:
>
> on run (user, info)
> tell application "Microsoft Entourage"
> create mail message
> set message recipient to user
> set message subject to "blah blah blah"
> set message account to "my account"
> set message text to "blah blah blah"+info+"blah blah blah"
> end tell
> end run
>
> I tried looking for scripting documentation at Mactopia, but all I got from
> the Entourage or Download links was a page with "VBScript error, server out
> of memory."
>
First of all, the best place to look is in the AppleScript Dictionary of Entourage -- just open it in your Script Editor, and you'll see all the events and classes. It may help you to supplement that with the AppleScript Reference from MacTopia. Then, it's a good idea to learn some general things about AppleScript syntax. there are lots of leads at the AppleScript page at the Apple website to tutorials, the Bill Briggs tutorials, MacScripter Magazine, and especially to the AppleScript Language Reference.
If you're just looking for someone else to do it for you, here you are. Things get more complicated if you ever need cc or bcc.
set user to "John Doe <[EMAIL PROTECTED]>" -- or [EMAIL PROTECTED]
set info to "What's this? Anything at all."
SendMail(user, info)
on SendMail(user, info)
tell application "Microsoft Entourage"
set theSubject to "blah blah blah"
set theRecipient to user
set theAccount to POP account "my account"
set theContent to "blah blah blah" & return & return & info & return & return & "blah blah blah"
set theMsg to make new outgoing message at out box folder with properties {account:theAccount, subject:theSubject, content:theContent, recipient:{address:user}}
send theMsg
end tell
end SendMail
--
Paul Berkowitz
- AppleScript to specify mail account Rick Johnson
- Paul Berkowitz
