Have you considered using something that already exists?
Like madExcept from http://www.madshi.net/. If it's non-commercial, you can use madExcept for free but you don't get the source. If you want the full freedom to use it for commercial products (and get the source), it's $99.
It gives you lots of options including mailing the report (amongst others) and includes options to collect a list of installed hardware.
I purchased a licence and it's been very useful.
Bookmarks