[jboss-user] [Installation, Configuration & Deployment] - JBOSS SMTP+TLS

mikala do-not-reply at jboss.com
Mon Oct 30 08:11:54 EST 2006


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("ts at hermenegilda.intranet"));
			msg.setRecipient(Message.RecipientType.TO, new InternetAddress("kalanskim at zeto.intranet"));
			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



More information about the jboss-user mailing list