set signature of outgoing message in Entourage (workaround sort of)

if you create a new outgoing message in entourage and set the account, one would think that the signature used would be the default signature for that account. but it is not. there appears to be no other way to set the signature for the outgoing message. (signature is not a property of a message!) it is possible to get the content of a signature you want to use for an account. however, it does not help because the signature of the default account has already been appended to the message.

this is a complicated work around, but it seems it is a MS Entourage bug, and a long standing one at that.

here’s a related thread:

http://bbs.applescript.net/viewtopic.php?id=5787


-- unique matching string of the email account of the desired pop account to send from:
property acctemail : "woodenbrain"  -- obviously unique to my case here -- put in your own
-- test variables:
property thename : "BILLYBOB"
property theemail : "billybob@test.com"
property subjecttext : "Test subject"
property replytext : "some reply text" & return

tell application "Microsoft Entourage"
	set replytext to "Dear " & thename & "," & return & return & replytext
	-- get the desired account as an object
	set theaccts to every POP account
	set desiredacct to ""
	repeat with i from 1 to (count theaccts)
		set anacct to item i of theaccts
		if email address of anacct contains acctemail then
			set desiredacct to anacct
			exit repeat
		end if
	end repeat
	-- get the actual signature of that account
	if desiredacct is not "" then
		set sig to ""
		set dst to default signature type of desiredacct
		if dst is "other" then
			set dsc to default signature choice of desiredacct
			set sig to content of dsc
		end if
		-- set the reply text to the original reply text and the signature
		if sig is not "" then
			set replytext to replytext & return & return & sig
			-- the only odd thing is that "return & return" seem never to be added
		end if
	end if
	set thereply to make new outgoing message with properties {recipient:theemail, subject:subjecttext, account:desiredacct}
	-- content must be set on separte line, because if you set content as a property of the outgoing message, Entourage will erroneously include the default POP signature
	set content of thereply to replytext
end tell