Execute an AppleScript in an AppleScript action:

This is the script text:
tell application "Mail"
activate
repeat (count (windows)) - 1 times
set miniaturized of window 2 to true
end repeat
end tell
Note: We have to repeatedly minimize window 2 because when the first window 2 is minimized apparently the window that formerly was window 3 becomes window 2 and so on.