Question on scripting Mail and stationery

Hi, I am currently working on a script for mail.app that can either

a) make a new outgoing mail and assign a stationery to it, or
b) manually plug in recipients and subject to a manually made message (since I can make a message with the stationery I need by manually accessing the stationery file through finder)

I don’t believe there’s any support for scripting stationery in Mail.app for Leopard at all, so a) is probably out of the question, unless I resort to UI scripting which I don’t want to do since this is a solution for my business that everyone will be using.

b) then would be the easier option, but I can’t find how to do this. How do I get the message id of the currently opened message, if it wasn’t done with the “make new outgoing message with properties…” Again I want to avoid UI scripting, so a way of setting the recipient and subject of the currently opened message would be really appreciated.

My solution for making a custom stationery message for each user is quite interesting by the way. Since there’s no way to do it officially, I output the content.html page that I need and then move it inside the installed custom stationery in my library folder. It works, and I can make a new message (currently) by telling the finder to open the stationery file, which creates the message I want. I just can’t insert to or subject

This will get the new message you made and allow you to set the subject…

tell application "Mail"
	set frontMessage to front outgoing message
	tell frontMessage
		set subject to "my new email message"
	end tell
end tell

Thanks, but in my case I am making a mail by using Applescript and “mail contents of page” since this is the only way I could come up with to create customized HTML mails to send to my customers. So the mail already exists, and I can’t find a way to get the ID of the currently created outgoing message so I can then refer to it. Any ideas there? In theory

tell application “Mail”
set subject of outgoing message 1 to “something”
end tell

would work, but it gives a class error.

I’m not sure what you mean. Post the script you use to make the email… maybe I can find something from that.