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

