SMTP port

Hi guys,

I have the following problem. I'm trying to set a different port (5225) to connect to the smtp server, but looks like it's not being considered. Another strange factor is that it is taking host I set, but not the port. And when I try to send the message I get the exception: "javax.mail.MessagingException: Could not connect to SMTP host: stadd65.us.oracle.com, port: 25", which obviously explains my problem, unless Sun guys are hard-coding the port. :)

Here goes a sneak peek of my code:

Properties props = System.getProperties();

props.put("mail.smtp.host", "mymachine");

props.put("mail.smtp.port", "5225");

// I've tried getInstance(props), getDefaultInstance(props, null) and getInstance(props, null)

m_session = Session.getDefaultInstance(props);

m_session.setDebug(false);

...

mimeMsg = new PIMAPMimeMessage(m_session);

...

Transport trans = mimeMsg.getSession().getTransport("smtp");

logger.finest("Connecting to SMTP");

mimeMsg.saveChanges();

trans.connect();

logger.finest("Sending message to SMTP");

trans.send(mimeMsg);

logger.finest("Closing connection to SMTP");

trans.close();

Any help/suggestion is appreciated.

Thanks.

George

[1294 byte] By [gmaggessa] at [2007-11-26 23:54:15]
# 1
http://java.sun.com/products/javamail/FAQ.html#send
bshannona at 2007-7-11 15:36:10 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...