I am trying to send a mail through JavaMail but I am getting an exception: Could not connect to SMTP host 25. How to give this SMTP host?

John Zukowski

If you get an exception like:

Exception in thread "main" javax.mail.MessagingException: Could not connect to SMTP host: www.myhost.com, port: 25;

it means there is no mail (SMTP) server software running on the designated host. You'll need to find an appropriate host to use as your transport.