javamail work with gmail but not with my new hosting

Here's my code

publicstaticvoid main(String args[])

{

try

{

String strTo ="myemail addr";

String Msg ="123123123";

Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());

Properties props =new Properties();

props.put("mail.smtp.host","smtp.gmail.com");

props.put("mail.smtp.auth","false");

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

props.put("mail.smtp.socketFactory.port","465");

props.put("mail.smtp.socketFactory.class","javax.net.ssl.SSLSocketFactory");

props.put("mail.smtp.socketFactory.fallback","false");

final String userMail ="my email";

final String userPwd ="my pwd";

// Get a Session object

Session session = Session.getDefaultInstance(props,new

javax.mail.Authenticator()

{

protected PasswordAuthentication

getPasswordAuthentication()

{

returnnew PasswordAuthentication(userMail, userPwd);

}

});

Message msg =new MimeMessage(session);

msg.setFrom(new InternetAddress(userMail));

msg.setRecipients(Message.RecipientType.TO,

InternetAddress.parse(strTo,false));

msg.setSubject("Thank You");

msg.setText(pwdMsg);

Transport.send(msg);

}

catch (Exception e)

{//Catch exception if any

System.err.println("Error: " + e.getMessage());

}

}

It worked, but when i changed to my smtp hosting:

- change the smtp host to the host they gave me

- change the port number to the port number they gave me

- change source email address and password to email address with their hosting

I got this exception: Exception reading response

Is it because I try to send email from my local computer (have not uploaded the file, hence I'm trying to use the smtp from my local computer) or problem with the smtp server ?

thanks for any help

[3232 byte] By [winedza] at [2007-11-27 6:50:44]
# 1
Most likely you've got it configured to expect SSL and they're notusing SSL, or vice versa.
bshannona at 2007-7-12 18:24:53 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

This is the error from tomcat

org.apache.jasper.JasperException: javax.servlet.ServletException: javax.mail.MessagingException: Exception reading response;

nested exception is:

javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?

org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:532)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:408)

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)

javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

I tried to remove:

Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());

and

props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");

but still does not work...

winedza at 2007-7-12 18:24:53 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3
It looks like you're forcing the connection to use SSL. Are you sure that'swhat the server is expecting? Maybe the server is expecting a plain textconnection, possibly followed by use of the STARTTLS command to switchit into SSL mode?
bshannona at 2007-7-12 18:24:53 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 4
yes..how to "not forcing" the ssl ? can u give modification of my code ? or any links i can read for reference ? have been searching at google and cannot find itthanks
winedza at 2007-7-12 18:24:53 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 5
It seems that you don't have any understanding at all of the code you're using...Did you find the JavaMail FAQ?Did you find the sample programs included with JavaMail?
bshannona at 2007-7-12 18:24:53 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...