Good news and bad news. First, the good news is that this is a fixable problem. The bad news is that it'll take a little work.
First and foremost, you need to get the mail windows that are minimized to the dock out of the dock. This is the biggest work part of it. I don't know a simple way of doing this, so, unless someone else can suggest something, you'll just have to go through clicking each of them to bring them back to full windows. Next, you'll need to close all of these windows. Thankfully, there is an easy way to do this. All you need to do is either hit Command-Option-W or select "Close All Windows" from the File menu. This will shut all windows that are not minimized to the dock. If its easier, you can take it in stages. Pull up 10-20 windows, hit Cmd-Opt-W. Repeat until all your windows are gone.
Hope this helps!