• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Entourage - send mail & attach on-the-fly
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Entourage - send mail & attach on-the-fly


  • Subject: Re: Entourage - send mail & attach on-the-fly
  • From: Paul Berkowitz <email@hidden>
  • Date: Tue, 06 Apr 2004 18:02:37 -0700

On 4/6/04 11:21 AM, "Matthew Leingang" <email@hidden> wrote:

> Hi folks,
>
> I am scripting Entourage to automatically send my vCard information as an
> attachment. This is what I've got so far:
>
> tell application "Microsoft Entourage"
> set newMail to make new outgoing message with properties ,
> {recipient:{address:"email@hidden"}, attachment:{file:"Macintosh
> HD:Users:matthew:mpl.vcf"}}
> set the subject of newMail to "Re: Your Mail"
> set the content of newMail to "Here's your vCard."
> send {newMail}
> end tell
>
> This creates the message just fine, but it doesn't send. I can open it up
> from Entourage and send it (to a real address, of course), but send
> {newMail} doesn't do anything.
>
> The Entourage dictionary says that send takes a list of messages -- do I
> have the syntax right?

For a single message you don't _need_ a list:

send newMail

will work, but so should


send {newMail}

Your problem is that you have not defined the properties of newMail
correctly. That's where the error is. The data type of the 'file' property
of attachment is 'alias', not 'string'. You need to prefix 'alias' to your
string file path. So if that really is the correct path to the vCard, then
this will work (I'm also including the subject and content properties when
making the message, to be concise, although your way is OK).

tell application "Microsoft Entourage"
set newMail to make new outgoing message with properties {subject:"Re:
Your Mail", content:"Here's your vCard.", recipient:{address:"email@hidden"},
attachment:{file:alias "Macintosh HD:Users:matthew:mpl.vcf"}}
send {newMail}
end tell
>
> You might wonder why this script has me attaching a file rather than getting
> the vCard data out of the me contact directly. This was the only way I
> could get the attachment to work. I tried things like
>
> attachment:{file:"foo.vcf",content:vCardData}
>
> But that caused Entourage to crash and return a connection error.

There's no 'content' property of attachment, so you can't do that. You can,
however do it this way, by making the file via That would look awfully
peculiar. You _could_ send the vCard data if you really want to, by making
the file via AppleScript:


--------------------

tell application "Microsoft Entourage"
set myData to vcard data of (me contact)
set myName to name of (me contact)
end tell

set fileSpec to (path to temporary items folder as Unicode text) & myName &
".vcf"

try
set f to open for access file fileSpec with write permission
set eof f to 0
write myData to f
close access f
on error
try
close access f
end try
beep
return
end try

tell application "Microsoft Entourage"
set newMail to make new outgoing message with properties {subject:"Re:
Your Mail", content:"Here's your vCard.", recipient:{address:"email@hidden"},
attachment:{file:alias fileSpec}}
send newMail
end tell

--------------------------

You could get the Finder or a shell script (rm) to delete the vCard, but I
put it in Temporary Items so you don't have to. Or you could keep it
somewhere permanent, but it makes more sense to make it anew (it takes a
split second) just in case you've updated your contact info.
>
>
>
>


--
Paul Berkowitz
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.


References: 
 >Entourage - send mail & attach on-the-fly (From: Matthew Leingang <email@hidden>)

  • Prev by Date: Re: Strange Error Reading File
  • Next by Date: popup in dialog possible?
  • Previous by thread: Entourage - send mail & attach on-the-fly
  • Next by thread: popup in dialog possible?
  • Index(es):
    • Date
    • Thread