Help needed: Applescript

LandyMan

Honorary Master
Joined
Feb 28, 2005
Messages
13,363
Reaction score
3,191
Location
Centurion
Hi all,

Ok, so Entourage does not have the option to generate read receipts automatically, but there is a script available to do so. However, whenever the script runs (I check for the header: Disposition-Notification-To and run the script accordingly) I get the following error:

Microsoft Entourage got an error: Some data was the wrong type

The Script:
Code:
-- Generate Return Receipt v1.1 (13th September 2004)
-- Barry Wainwright <[email protected]>
-- This script (for Microsoft Entourage® vX or later)
-- will generate a 'Return Receipt' for messages received 
-- with a "Disposition-Notification-To" header.
-- The format of the returned receipt is similar to those returned by Microsoft Outlook



tell application "Microsoft Entourage"
	-- Get the message
	try
		set theMess to item 1 of (get current messages)
	on error
		return -- script was called with no message selected
	end try
	
	set theSender to sender of theMess
	if display name of theSender is "" then
		set theSender to address of theSender
	else
		set theSender to display name of sender of theMess & " <" & address of sender of theMess & ">"
	end if
	
	-- Get my details
	set myAccount to account of theMess
	set myName to full name of myAccount
	set myEmail to email address of myAccount
	-- Generate the reply details
	set newSubject to "Return Receipt (displayed) - [" & subject of theMess & "]"
	set bodyText to "This is a Return Receipt for the mail you sent to <" & myEmail & ">.
	
Note: This Return Receipt only acknowledges that the message was received on the recipient's computer. There is no guarantee that the recipient has read or understood the message contents.
	
 -----------------------

Reporting-UA: Microsoft-Entourage/" & (version as text) & "
Final-Recipient: rfc822;<" & myEmail & ">
Disposition: automatic-action/MDN-sent-automatically; displayed
	
-----------------------
	
Message Information:
Subject: " & the subject of theMess & "
To: " & theSender & "
Date:  " & ((time sent of theMess) as text) & "
Received: " & ((time received of theMess) as text)
	
	-- Make the reply message 
	make new draft window with properties {account:myAccount, recipient:theSender, subject:newSubject, content:bodyText}
	
end tell

Anything blatantly wrong here?

EDIT: It only gives the error when it is generating the response from an Exchange account, and not from POP
 
Last edited:
Does it have to be applescript? Wont a rule do the same thing?
 
Erm, are there any automator actions for entourage that will make this easier?
Otherwise is the form of the 'Received' field of your mail correct?
 
Why not edit it to start with one block of code ( the first "try" ) and add blocks until you find which line is giving the problem?
 
Does it have to be applescript? Wont a rule do the same thing?

You use a rule looking for "Disposition-Notification-To" in the headers, and if it is found, it runs the Applescript

Erm, are there any automator actions for entourage that will make this easier?
Otherwise is the form of the 'Received' field of your mail correct?

When debugging through AppleScript, it generates everything correctly, but gives the error when trying to open the return message. Again, this is only a problem on my Exchange accounts, and not POP accounts.

Why not edit it to start with one block of code ( the first "try" ) and add blocks until you find which line is giving the problem?

See my response to BobJones above
 
You use a rule looking for "Disposition-Notification-To" in the headers, and if it is found, it runs the Applescript

Wont this rule do the job?

Code:
If
Specific header Disposition-Notification-To Exists

Then
Display dialog [I]Display message[/I] (I guess you can ignore this if you dont want dialogue) 
Reply [I]Reply text[/I]...
 
bwana, I suppose that will work ... the nice thing about the Applescript though is that it works like the Outlook functionality ... have the option to actually send the return receipt or discard it
 
bwana, I suppose that will work ... the nice thing about the Applescript though is that it works like the Outlook functionality ... have the option to actually send the return receipt or discard it
Hope you get the applescript sorted then - funny that it doesnt work with an exchange account. Wonder why :confused:

I dont like receipts and I loathe entourage so I'm not going to be much help anyway :D
 
Hope you get the applescript sorted then - funny that it doesnt work with an exchange account. Wonder why :confused:

I dont like receipts and I loathe entourage so I'm not going to be much help anyway :D

But you know Applescript quite well, so I was hoping :)

What I picked up on the different sites is that it has something to do with the management of return receipts on the Exchange server somehow ... don't really know what exactly
 
Top
Sign up to the MyBroadband newsletter
X