You're asking for a lot of data, some of which is pretty much not connected together.
For email, look up the RFCs that define MIME compliant attachments and how to create them, they come in real handy (i'll try to look them up and post them a little later)
As for analyzing usage, you can really on do that on sites you either host, or proxy.
It's important to design any bulk mailing application with the user in mind. How will you get their email addresses? Are you buying a large list from a company that just harvests email addresses from the internet? This may not be a good move, as most of those folks don't want to receive spam, and will view unsolicited email as such.
Is it a list from your company's own database of contact emails from people who expect to see email from you in their inbox?
Are these people gonna sign up on your site?
To analyze traffic on your own site, you can either use grep and write your own scripts to do it, or use something like webalizer, which will do a lot of analysis for you, but may not do just what you need.