I want to export each message in Mail to a file but I need the raw message source which includes attachments.
I tried scripting Mail without any luck.
The following almost works but it doesn’t actually save the file; its like the enter key never gets hit.
tell application "Mail"
activate
tell application "System Events"
keystroke "s" using {command down, shift down}
keystroke "1.msg"
keystroke return
end tell
end tell
Thanks Stefan, unfortunately your solution didn’t work; I kept getting an error.
By dumb luck I got the following code to work:
activate application "Mail"
tell application "System Events"
tell process "Mail"
keystroke "s" using {command down, shift down}
keystroke "1.msg"
delay 1
end tell
keystroke return
end tell
I guess when Mail has the save dialog up it stops responding to apple script but System Events can still press the enter key. Hope this saves someone else a few hours of aggravation.