El Capitan: Forward Message in Mail change contents / add attachmement

Hi there

Since I’ve updated to El Capitan (10.11) the following AS does not work anymore:

tell application "Mail"
	
	set selected_mail to selection
	set forward_mail to forward item 1 of selected_mail
	
	tell forward_mail
		make new attachment with properties {file name:attach_file} at before last paragraph
	end tell
	
end tell

I get an error, that tells, that the content could not be read.

Any suggestions?

Thank you very much in advance
Marth

Here is an edited version of an old script.
I don’t understand why the attach process fails when I try to forward a mail but behaves flawlessly when I redirect it.

set attach_file to (choose file)

tell application "Mail"
	activate
	set selected_mail to selection
	set a_mail to item 1 of selected_mail
	-- set newMail to forward a_mail
	set newMail to redirect a_mail
	tell newMail
		set nbAttachments to 0
		make new attachment with properties {file name:attach_file} at before last paragraph of content
		# Loop waiting for the attach process ending
		repeat 100 times
			if (count attachment) > nbAttachments then
				set nbAttachments to nbAttachments + 1
				exit repeat # If the attachment is really attached, exit this loop
				tell me to delay 0.2 # delay before an other test
			end if
		end repeat
	end tell
	
end tell

Yvan KOENIG running Sierra 10.12.4 in French (VALLAURIS, France) vendredi 12 mai 2017 14:54:06

Hi Yvan

Thank you very much for your quick answer.

I’d tried your script, but unfortunately I get the same error. at the point, when the script want to make the new attachment. It says (german translated) "

I guess the problem is, that in El Capitan it isn’t possible to get/change the content of an outgoing message anymore. So when i try to get only the content of the forwarded message, I get the same error.

Does someone know a soloution/workaround for this?

Thank you very much
Marth

Good news.

Here with 10.12.5 final the script behaves flawlessly.

Yvan KOENIG running Sierra 10.12.5 in French (VALLAURIS, France) mercredi 17 mai 2017 10:48:27