Need help in designing mail server

I am designing an application using jsp.In that application, I need to provide users with facility to send and recieve emails.Please guide me how to use JavaMail APIs.
I have one doubt that, Is it necessary to check mail system only after deploying the application on the hosting server.???

I don't want to write mail server on my own. But how can I test whether my application (written based out of the tutorial) will work fine or not? Need more details on testing and implementation point of view.