I’ve got the following…
Properties prop = new Properties();
prop.put(host, "localhost");
prop.put(host, "25");
When I run the following it throws me back the following error…
javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
nested exception is:
java.net.ConnectException: Connection refused
I don’t really understand why it’s throwing me this back… anyone have any ideas? my smtp server is in fact up and working as far as I can tell :S
edit: If I understand correctly it’s telneting to my machine.. why? it shouldn’t be… It’s meant to be telneting to host.
I think you have the property to set the host incorrect:
This will create a property with the key of whatever is in host and call it localhost. I’m guessing that your property isn’t what you think it is so JavaMail is then using the default of localhost.
You propably want this instead: