Printing an email from Mail

Is it really impossible to print an email from Mac Mail using AppleScript? The print command is right there in the dictionary but I can’t get it to work. Online I’ve seen people devising GUI work arounds as well as saving the contents of the email as text and then printing via TextEdit. Is there really no other simple way?

The dictionary claims that the print command apply to a document but when we try to get the document of a message window we get missing value.

It’s why I am unable to use this command.

A bare GUI scripting code would be :

tell application "System Events" to tell process "Mail"
	set frontmost to true
	keystroke "p" using {command down}
	repeat until exists sheet 1 of window 1
		delay 0.05
	end repeat
	keystroke return
end tell

Yvan KOENIG running El Capitan 10.11.5 in French (VALLAURIS, France) dimanche 5 juin 2016 10:48:16

Thanks Yvan, now I know it’s true, I will use the GUI work-around.

It’s a shame that Apple does not support AppleScript properly for its own applications. Incomplete support for Mail and no support for Preview, these are two examples I know about.

CAUTION

The fact that I found no way to print an email using the dedicated print command doesn’t prove that the feature is broken.
It just prove that I am unable to use it.
Maybe there is a trick which I missed.

Yvan KOENIG running El Capitan 10.11.5 in French (VALLAURIS, France) dimanche 5 juin 2016 15:32:39

Is there a way to talk to an Apple engineer about these things?

The only real feedback channel is bugreport.apple.com. The more the merrier.