If you want, you can write your own mail application and use a component like Jmail or ASPemail or ASPmail or ... etc... to connect your pages to the mail server. But you'll be doing a LOT of work.
If you are looking for a web mail solution, you're probably best off going with a commercial web mail component. They range from about $100 to $500 with others going for thousands for large sites.
This one http://www.chilkatsoft.com/ goes for about $100, but I haven't used it. IceWarp works well (I've used it before). You can find it at http://www.icewarp.com and has pretty flexible pricing.
If you could be more specific about what you have/are doing right now and what you are running, perhaps someone could help you out a bit more. The above is a bit vauge, but a start anyways.
Hope it helps.