title: Is it possible to connect to a mail server without hard coding the port using JavaMail api's, basically the code should be independent of ports. ?
body: <p>I am working on an application where the app should able to read/fetch the emails from a smtp server. The problem is the ports may differ in different environment. Is there any way to connect to smtp/pop (microsoft exchage) server without knowing the port. Any information might be helpful because of I am new to this javamail api's. </p>