views:

45

answers:

2

For finding the ip address of the smtp server in java? I cant find the right api method.

Thank you

+1  A: 
InetAddress addr = InetAddress.getByName(hostname);

See the docs. However, I'm not clear why you want to do this.

Matthew Flaschen
thank you very much
rob
A: 

You must ask the system administrator as this is not standardized.

A frequent scenario on Linux-machines is that the machine itself knows how to send out mail. In that case you would use "127.0.0.1" as the SMTP host.

Thorbjørn Ravn Andersen