HI,i have been using a java class to send mail for a long time in TomCat with no problems at all

But now we are moving to SunOne server and my class doesn't work anymore. it sends mails to local accounts but doesnt send mail to other addresses.Is that an authentication problem?

this is my sendMail method:


public boolean sendMail(String from, String to, String subjectText, String msgText, String host) {



// create some properties and get the default Session
Properties props = new Properties();
props.put("mail.smtp.host", host);

Session session = Session.getDefaultInstance(props, null);
session.setDebug(false);

try {
// create a message
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
InternetAddress[] address = {new InternetAddress(to)};
msg.setRecipients(Message.RecipientType.TO, address);
msg.setSubject(subjectText);
msg.setSentDate(new Date());
// If the desired charset is known, you can use
// setText(text, charset)
msg.setText(msgText);

Transport.send(msg);
} catch (MessagingException mex) {
System.out.println("\n--Exception handling in msgsendsample.java");

mex.printStackTrace();
System.out.println();
Exception ex = mex;
do {
if (ex instanceof SendFailedException) {
SendFailedException sfex = (SendFailedException)ex;
Address[] invalid = sfex.getInvalidAddresses();
if (invalid != null) {
System.out.println(" ** Invalid Addresses");
if (invalid != null) {
for (int i = 0; i < invalid.length; i++)
System.out.println(" " + invalid[i]);
}
}
Address[] validUnsent = sfex.getValidUnsentAddresses();
if (validUnsent != null) {
System.out.println(" ** ValidUnsent Addresses");
if (validUnsent != null) {
for (int i = 0; i < validUnsent.length; i++)
System.out.println(" "+validUnsent[i]);
}
}
Address[] validSent = sfex.getValidSentAddresses();
if (validSent != null) {
System.out.println(" ** ValidSent Addresses");
if (validSent != null) {
for (int i = 0; i < validSent.length; i++)
System.out.println(" "+validSent[i]);
}
}
}
System.out.println();
} while ((ex = ((MessagingException)ex).getNextException())
!= null);
}
return false;