PLEASE HELP ME
I try to to connect to smtp mail server with TLS. I have JBOSS 4.0.1Sp1. I
repleced mail.jar from server/default/lib with the latest version 1.4.(this
version support SMTP+TLS)
I have the sample code which is working outside the JBOSS but not in JBOSS:
String port = "25";
java.util.Properties props = new java.util.Properties();
props.setProperty("mail.debug", "true");
props.setProperty("mail.smtps.socketFactory.port", port);
props.setProperty("mail.smtps.socketFactory.fallback", "false");
props.setProperty("mail.smtps.auth", "true");
props.put("mail.smtps.host", "hermenegilda.intranet");
props.put("mail.smtp.host", "hermenegilda.intranet");
props.put("mail.smtp.port", 25);
props.put("mail.smtp.auth", "true");
props.setProperty("mail.smtp.starttls.enable", "true");
java.security.Security.setProperty("ssl.SocketFactory.provider","com.zetokatowice.talgos.common.util.mail.DummySSLSocketFactory");
try {
Session session = Session.getInstance(props, new
Authenticator() {
protected PasswordAuthentication
getPasswordAuthentication() {
return new PasswordAuthentication("ts",
"ts");
}
});
MimeMessage msg = new MimeMessage(session);
msg.setText("test");
msg.setSubject("test");
msg.setFrom(new InternetAddress("[EMAIL PROTECTED]"));
msg.setRecipient(Message.RecipientType.TO, new
InternetAddress("[EMAIL PROTECTED]"));
Transport tr = session.getTransport("smtp");
tr.connect();
tr.sendMessage(msg, msg.getAllRecipients());
tr.close();
} catch (Exception e) {
e.printStackTrace();
}
When I run this code outside the JBOSS, TLS connection is open using my
DummySSLSocketFactory but when i try to run it on JBOSS connection is opend
using default factory.
How to tell JBOSS to use my DummySSLSocketFactory ?
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3981752#3981752
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3981752
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user