Hallo, I was tried sending the form to e-mail adress and I got :
19:57:11,390 ERROR [STDERR] java.lang.IllegalStateException: Not connected
19:57:11,391 ERROR [STDERR]     at 
com.sun.mail.smtp.SMTPTransport.checkConnected(SMTPTransport.java:1029)
19:57:11,391 ERROR [STDERR]     at 
com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:288)


I Havem datasource defined in mail-service.xml deployed as java:/Mail, and 
Postfix program on localhost.

I have code:
Context initCtx = new InitialContext();
javax.mail.Session session = (javax.mail.Session) initCtx.lookup("java:/
Mail");
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress("[EMAIL PROTECTED]"));
message.setSubject("mail.subject");
message.setText(body.toString());
Transport transport = session.getTransport();
transport.sendMessage(message,
 new InternetAddress[]{new InternetAddress("[EMAIL PROTECTED]")});

Where is problem?
Thanks, Jiri



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to