|
There are my two methods from my MailerBean: public void setMessage(String recipient, String cc, String subject, String content) throws Exception, RemoteException { System.out.println("SessionMailerBean.setMessage: checkpoint 1."); // Get the initial context InitialContext ictx = null; try { ictx = new InitialContext(); } catch (NamingException e) { throw new Exception("Can not get an inital context : " + e.getMessage()); } // get a new Session from our ENC envirnoment java:comp/env Session session = null; try { session = (Session) ictx.lookup("java:comp/env/mail/MailSession"); } catch (NamingException e) { throw new Exception("You have not configure the mail factory " + " ifor java:comp/env/mail/MailSession." + e.getMessage()); } session.setDebug(true); try { //Create the message message = new MimeMessage(session); InternetAddress[] toRecipients = new InternetAddress[] {new InternetAddress(recipient)}; message.setRecipients(Message.RecipientType.TO, toRecipients); message.setSubject(subject, MAIL_CHARSET); message.setText(content, MAIL_CHARSET); if ( null != cc ) { InternetAddress[] ccs = new InternetAddress[] {new InternetAddress(cc)}; message.setRecipients(Message.RecipientType.CC, ccs); } //message.setContent(content, "text/plain"); } catch (MessagingException e) { throw new Exception("A failure occurs when getting a message from the session and setting " + "the different parameters :" + e.getMessage()); } System.out.println("SessionMailerBean.setMessage: checkpoint 2."); } public void send() throws Exception, RemoteException { System.out.println("SessionMailerBean.send: checkpoint 1."); if (message == null) { throw new Exception("The message can not be send because the method setMessage() " + " was not called before the send() method."); } try { Transport.send(message); } catch (MessagingException e) { throw new Exception("The message can not be send : " + e.getMessage()); } System.out.println("SessionMailerBean.send: checkpoint 2."); } I've add debug to mail session but nothing :-( Unfortunatelly i have not configured environment for remote debug. Any advice? Best regards, Alex Andrushchak Rajith Attapattu wrote:
|
- javamail Alex Andrushchak
- Re: javamail Rajith Attapattu
- Re: javamail Alex Andrushchak
- Re: javamail Rajith Attapattu
- Re: javamail Alex Andrushchak
- Re: javamail Rajith Attapattu
- Re: javamail Alex Andrushchak
- Re: javamail Rajith Attapattu
- Re: javamail Alex Andrushchak
- Re: javamail Ken McArthur
- Re: javamail Alex Andrushchak
- Re: javamail Jakob Færch (Trifork)
- Re: javamail Alex Andrushchak
- Re: javamail Jakob Færch
- Re: javamail Alex Andrushchak
- Re: javamail Alex Andrushchak
- Re: javamail Jakob Færch (Trifork)
