customer SSL for smtp
hello
I have a code it does not work and which enables to send an email via the server smtp.my problem it is that in my code I do not know how to negotiate the keys and the certificates of my server.
String trustStorefile ="java.home"/lib/security/cacerts";
String pwd ="changeit";
String protocol ="smtp";
String socketFactory ="javax.net.ssl.SSLSocketFactory";
String smtpAuth ="true";
String strport ="25";
String username ="toto";
String Password ="xxxxx";
String serveur ="smtp.xxx.xx.xx";
Properties props = System.getProperties();
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");
System.setProperty("javax.net.ssl.trustStore", trustStorefile);
System.setProperty("javax.net.ssl.keyStorePassword", pwd);
Security.setProperty("ssl.SocketFactory.provider","DummySSLSocketFactory");
props.setProperty("mail.transport.protocol",protocol);
props.setProperty("mail.smtp.port",strport);
props.setProperty("mail.smtp.starttls.enable","true");
props.setProperty("mail.smtp.auth", smtpAuth);
props.setProperty("mail.smtp.socketFactory.class", socketFactory);
props.setProperty("mail.smtp.socketFactory.fallback","false");
props.setProperty("mail.smtp.socketFactory.port",strport);
session = Session.getInstance( props);
URLName url =new URLName(protocol, serveur, Integer.parseInt(strport),"", username, Password);
com.sun.mail.smtp.SMTPSSLTransport transport =new com.sun.mail.smtp.SMTPSSLTransport(session, url);
transport.setStartTLS(true);
session.setDebug(true);
.....
thank you to help me.

