Sunday, 18 August 2013

Opening socket successful, but can't connect to SMTP Server?

Opening socket successful, but can't connect to SMTP Server?

Succinctly, is it possible that I could successfully open a socket on an
SMTP server, but be blocked from connecting to the server?
More details: I'm using javamail API to send an email. My code works to
send an email through smtp server running locally (papercut). Moverover,
with authentication properties added, it works through gmail. However, the
code doesn't work on the production server for which my script is intended
- I receive the following:
Could not connect to SMTP host: , port: 25
I spoke with the network personnel and they claim to have whitelisted the
application server for using this smtp server and port. I verified that I
can open a socket, using
try {
Socket socket = new Socket("xx.xx.xx.xx", 25);
OutputStream out = socket.getOutputStream();
out.write(outputStream.toByteArray());
socket.close();
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}

No comments:

Post a Comment