Copy HTML content from one message to another in Entourage?

Normally if you create a message in Entourage, you can click a HTML button on the message window. In the Entourage prefs we can turn this on permanently.

I want to copy HTML message content from one email to another new message.


tell application "Microsoft Entourage"
		activate
		set mycontent to the content of message 1 of folder "Templates" --mycontent contains NO HTML!!
		make new draft window
		set the content of window 1 to mycontent
end tell

This alternative doesn’t work either:


tell application "Microsoft Entourage"
		activate
		set mysource to the source of message 1 of folder "Templates" --mysource contains HTML !!
		make new draft window
		set the source of window 1 to mysource -- is not allowed  :(
end tell

This should do the job (adjust as needed):

tell application "Microsoft Entourage"
	make new outgoing message at out box folder with properties {source:get source of message 1 of folder 1, recipient:"user@folk.net"}
end tell

Thanks jj!

I must admit that I considered this option, but the problem is that when I create a new message this way, open it and edit it straight away (it’s a template!) and decide to cancel, I’m stuck with a message in my Out Box which I have to delete.

“make new draft window” has the advantage that when I decide to cancel editing nothing has to be cleaned up. (And the disadvantage that source can’t be defined…)

You can “make” it “at deleted mail folder”…
This also works (as is):

tell application "Microsoft Entourage"
	make new draft window with properties {has html:true, content:"<html><body bgcolor=red>asdf"}
end tell

Perhaps you are also interested in adapting this kind of code (?):

tell application "Microsoft Entourage"
	set htmlContents to content of part 1 of message 1 of folder 1
	
	set start to offset of "<html>" in htmlContents
	set endt to offset of "</html>" in htmlContents
	
	set htmlContents to text start thru (endt + 6) of htmlContents
	
	make new draft window with properties {has html:true, content:htmlContents}
end tell

Thanks, jj!

You can “make” it “at deleted mail folder”…
I guess I’ll do this!

Your last approach looks very interesting, but it generates an error at (the message and folder both do exist):

set htmlContents to content of part 1 of message 1 of folder "Templates"

Error msg: Cant get content of part 1 of message 1 of folder “Templates”

I looked in the Entourage dictionary and found “part”. Never knew a message had “parts”. What do they do? How many parts can a message have? Why would you have different parts?

These maybe the parts in “multipart” messages. For example, the first part could be the plain-text part (displayed by email clients unable to render HTML); the second one could be HTML; the third one an attachment; the fourth one enriched-text (not rtf); the fifth one, another attachment…
Just take a look to one of your messages (html or with attachments) and use the “view source” menu. You will see (if it is a multipart message) a tag at the beginning, next to the “From:”, “Subject:”, etc., called “Content-type:”. If this is “multipart/" (the "” is usually “mixed” or “alternative”), you can browse the parts of the messages looking for the “boundaries” (chunk of text which separates the different parts).

OK, got it.
Thanks for explaining jj!