5 Replies Latest reply on May 23, 2013 9:13 PM by kaushal7649

    Configuring Seam Mail programmatically

    mahbe

      Hi,

      is it possible to configure Seam Mail programmatically?

      I've already been using Seam Mail and configured it with <mail:mail-session ...> in components.xml. That works fine.

      But how to configure settings like hostname or port of the mailserver at runtime? I tried

      MailSession session = new MailSession().create();
      session.setHost("mailserver");
      session.setPort(4711);

      before I sent mail via
      renderer.render("/email-template.xhtml");


      But those settings do not work. I also tried some variations like this
      @In(create = true)
      MailSession mailSession;
      ...


      In this case a exception is thrown (...could not set field value...). Unfortunately the API documentation on Seam Mail is not very detailed.

      Best Regards, Matthias

        • 1. Re: Configuring Seam Mail programmatically
          pmuir

          Do

          MailSession mailSession = new MailSession();
          mailSession.setXXX();
          ...
          mailSession.create();
          
          Contexts.getEventContext().set("org.jboss.seam.mailSession", mailSession);


          There is not much doc on MailSession as it's not part of the Seam public API ;)

          • 2. Re: Configuring Seam Mail programmatically
            mahbe

            With Contexts, I think you suppose org.jboss.seam.contexts.Contexts?

            I tried that, but Seam Mail still uses localhost:25 as mailserver (exchange:25 would be right):

            09:15:03,296 INFO [MailSession] Creating JavaMail Session (exchange:25)
             09:15:03,296 INFO [MailSession] connected to mail server
            09:15:10,109 ERROR [STDERR] 15.01.2008 09:15:10 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
            INFO: Added Library from: jar:file:/C:/JBoss-4.2.0-GA/server/default/tmp/deploy/tmp41789LMS.ear-contents/LMS-exp.war/WEB-INF/lib/jboss-seam-ui.jar!/META-INF/s.taglib.xml
            09:15:10,109 ERROR [STDERR] 15.01.2008 09:15:10 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
            INFO: Added Library from: jar:file:/C:/JBoss-4.2.0-GA/server/default/tmp/deploy/tmp41789LMS.ear-contents/LMS-exp.war/WEB-INF/lib/richfaces-ui-3.1.2.GA.jar!/META-INF/ajax4jsf.taglib.xml
            [...]
            09:15:10,609 INFO [MailSession] Creating JavaMail Session (localhost:null)
             09:15:10,609 INFO [MailSession] connected to mail server
            09:15:11,593 ERROR [STDERR] javax.faces.FacesException: Could not connect to SMTP host: localhost, port: 25
            09:15:11,593 ERROR [STDERR] at org.jboss.seam.mail.ui.UIMessage.encodeEnd(UIMessage.java:146)
            09:15:11,593 ERROR [STDERR] at org.jboss.seam.ui.util.JSF.renderChild(JSF.java:181)
            09:15:11,593 ERROR [STDERR] at org.jboss.seam.ui.util.JSF.renderChildren(JSF.java:163)
            09:15:11,593 ERROR [STDERR] at org.jboss.seam.ui.facelet.FaceletsRenderer.renderFacelet(FaceletsRenderer.java:206)
            09:15:11,593 ERROR [STDERR] at org.jboss.seam.ui.facelet.FaceletsRenderer$1.process(FaceletsRenderer.java:160)
            09:15:11,593 ERROR [STDERR] at org.jboss.seam.ui.facelet.FaceletsRenderer$RenderingContext.run(FaceletsRenderer.java:78)
            09:15:11,593 ERROR [STDERR] at org.jboss.seam.ui.facelet.FaceletsRenderer.render(FaceletsRenderer.java:169)
            09:15:11,593 ERROR [STDERR] at de.sbe.lms.steuerungen.benutzer.VersendeLizenzdateiStrg.sende(VersendeLizenzdateiStrg.java:162)
            09:15:11,593 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            09:15:11,593 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            09:15:11,593 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            09:15:11,593 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            09:15:11,593 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
            09:15:11,593 ERROR [STDERR] at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
            09:15:11,593 ERROR [STDERR] at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:44)
            09:15:11,609 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
            09:15:11,609 ERROR [STDERR] at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
            09:15:11,609 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
            09:15:11,609 ERROR [STDERR] at org.jboss.seam.persistence.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:48)
            09:15:11,609 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
            09:15:11,609 ERROR [STDERR] at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
            09:15:11,609 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
            09:15:11,609 ERROR [STDERR] at org.jboss.seam.core.ConversationInterceptor.aroundInvoke(ConversationInterceptor.java:56)
            09:15:11,609 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
            09:15:11,609 ERROR [STDERR] at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
            09:15:11,609 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
            09:15:11,609 ERROR [STDERR] at org.jboss.seam.persistence.EntityManagerProxyInterceptor.aroundInvoke(EntityManagerProxyInterceptor.java:26)
            09:15:11,609 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
            09:15:11,609 ERROR [STDERR] at org.jboss.seam.persistence.HibernateSessionProxyInterceptor.aroundInvoke(HibernateSessionProxyInterceptor.java:27)
            09:15:11,609 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
            09:15:11,609 ERROR [STDERR] at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
            09:15:11,609 ERROR [STDERR] at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
            09:15:11,609 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor1471.invoke(Unknown Source)
            09:15:11,609 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            09:15:11,609 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            09:15:11,609 ERROR [STDERR] at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
            09:15:11,609 ERROR [STDERR] at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
            09:15:11,609 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            09:15:11,609 ERROR [STDERR] at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:71)
            09:15:11,609 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            09:15:11,609 ERROR [STDERR] at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
            09:15:11,609 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            09:15:11,609 ERROR [STDERR] at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
            09:15:11,609 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            09:15:11,609 ERROR [STDERR] at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
            09:15:11,609 ERROR [STDERR] at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
            09:15:11,609 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            09:15:11,609 ERROR [STDERR] at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
            09:15:11,609 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            09:15:11,609 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:83)
            09:15:11,609 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            09:15:11,609 ERROR [STDERR] at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
            09:15:11,609 ERROR [STDERR] at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106)
            09:15:11,609 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            09:15:11,625 ERROR [STDERR] at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
            09:15:11,625 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            09:15:11,625 ERROR [STDERR] at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
            09:15:11,625 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            09:15:11,625 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:204)
            09:15:11,625 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:100)
            09:15:11,625 ERROR [STDERR] at $Proxy631.sende(Unknown Source)
            09:15:11,625 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            09:15:11,625 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            09:15:11,625 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            09:15:11,625 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            09:15:11,625 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
            09:15:11,625 ERROR [STDERR] at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
            09:15:11,625 ERROR [STDERR] at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
            09:15:11,625 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
            09:15:11,625 ERROR [STDERR] at org.jboss.seam.ejb.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:41)
            09:15:11,625 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
            09:15:11,625 ERROR [STDERR] at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
            09:15:11,625 ERROR [STDERR] at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
            09:15:11,625 ERROR [STDERR] at org.javassist.tmp.java.lang.Object_$$_javassist_4.sende(Object_$$_javassist_4.java)
            09:15:11,625 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            09:15:11,625 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            09:15:11,625 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            09:15:11,625 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            09:15:11,625 ERROR [STDERR] at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:328)
            09:15:11,625 ERROR [STDERR] at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:273)
            09:15:11,625 ERROR [STDERR] at org.jboss.el.parser.AstMethodSuffix.getValue(AstMethodSuffix.java:59)
            09:15:11,625 ERROR [STDERR] at org.jboss.el.parser.AstMethodSuffix.invoke(AstMethodSuffix.java:65)
            09:15:11,625 ERROR [STDERR] at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
            09:15:11,625 ERROR [STDERR] at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
            09:15:11,625 ERROR [STDERR] at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
            09:15:11,625 ERROR [STDERR] at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
            09:15:11,625 ERROR [STDERR] at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
            09:15:11,625 ERROR [STDERR] at javax.faces.component.UICommand.broadcast(UICommand.java:383)
            09:15:11,625 ERROR [STDERR] at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:184)
            09:15:11,625 ERROR [STDERR] at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:162)
            09:15:11,625 ERROR [STDERR] at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:350)
            09:15:11,625 ERROR [STDERR] at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
            09:15:11,625 ERROR [STDERR] at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
            09:15:11,625 ERROR [STDERR] at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
            09:15:11,625 ERROR [STDERR] at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
            09:15:11,625 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
            09:15:11,640 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            09:15:11,640 ERROR [STDERR] at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:307)
            09:15:11,640 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            09:15:11,640 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            09:15:11,640 ERROR [STDERR] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
            09:15:11,640 ERROR [STDERR] at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
            09:15:11,640 ERROR [STDERR] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            09:15:11,640 ERROR [STDERR] at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
            09:15:11,640 ERROR [STDERR] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            09:15:11,640 ERROR [STDERR] at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
            09:15:11,640 ERROR [STDERR] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            09:15:11,640 ERROR [STDERR] at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
            09:15:11,640 ERROR [STDERR] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            09:15:11,640 ERROR [STDERR] at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
            09:15:11,640 ERROR [STDERR] at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
            09:15:11,640 ERROR [STDERR] at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
            09:15:11,640 ERROR [STDERR] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            09:15:11,640 ERROR [STDERR] at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
            09:15:11,640 ERROR [STDERR] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            09:15:11,640 ERROR [STDERR] at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
            09:15:11,640 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            09:15:11,640 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            09:15:11,640 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
            09:15:11,640 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            09:15:11,640 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            09:15:11,640 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
            09:15:11,640 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
            09:15:11,640 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
            09:15:11,640 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
            09:15:11,640 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
            09:15:11,640 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
            09:15:11,640 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
            09:15:11,640 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
            09:15:11,640 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
            09:15:11,640 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
            09:15:11,640 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
            09:15:11,640 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
            09:15:11,640 ERROR [STDERR] Caused by: javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
             nested exception is:
             java.net.ConnectException: Connection refused: connect
            09:15:11,640 ERROR [STDERR] at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1282)
            09:15:11,640 ERROR [STDERR] at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
            09:15:11,656 ERROR [STDERR] at javax.mail.Service.connect(Service.java:275)
            09:15:11,656 ERROR [STDERR] at javax.mail.Service.connect(Service.java:156)
            09:15:11,656 ERROR [STDERR] at javax.mail.Service.connect(Service.java:105)
            09:15:11,656 ERROR [STDERR] at org.jboss.seam.mail.ui.UIMessage.encodeEnd(UIMessage.java:140)
            09:15:11,656 ERROR [STDERR] ... 132 more
            09:15:11,656 ERROR [STDERR] Caused by: java.net.ConnectException: Connection refused: connect
            09:15:11,656 ERROR [STDERR] at java.net.PlainSocketImpl.socketConnect(Native Method)
            09:15:11,656 ERROR [STDERR] at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
            09:15:11,656 ERROR [STDERR] at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
            09:15:11,656 ERROR [STDERR] at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
            09:15:11,656 ERROR [STDERR] at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
            09:15:11,656 ERROR [STDERR] at java.net.Socket.connect(Socket.java:507)
            09:15:11,656 ERROR [STDERR] at java.net.Socket.connect(Socket.java:457)
            09:15:11,656 ERROR [STDERR] at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:232)
            09:15:11,656 ERROR [STDERR] at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189)
            09:15:11,656 ERROR [STDERR] at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1250)
            09:15:11,656 ERROR [STDERR] ... 137 more


            This one
            09:15:10,609 INFO [MailSession] Creating JavaMail Session (localhost:null)
            09:15:10,609 INFO [MailSession] connected to mail server

            appears only the first time I call the mail function after deployment. It 'seams' that Seam Mail ignores the manual settings and creates one time its own MailSession instance.

            Beyond Contexts.getEventContext() I also tried application and conversation context, but that doesn't work, too.

            Best Regards, Matthias

            • 3. Re: Configuring Seam Mail programmatically
              pmuir

              Ah. I forgot I had actually coded in support for what you want:

              <m:message mailSession="#{myMailSession}">
               ...


              So, just expose your javax.mail.Session as a context variable, and set it in the mail template.

              • 4. Re: Configuring Seam Mail programmatically
                mahbe

                 

                <m:message session="...">

                works much better ;-)

                But thanks anyway!

                • 5. Re: Configuring Seam Mail programmatically
                  kaushal7649

                  Hi Pete,

                   

                       <m:message mailSession="#{myMailSession}">
                  ...
                  I am not getting your above line. what do you mean? I have to set mailSession in <m:message> tag ?

                  <m:message> has not "mailSession" attribute.

                  Please expain me above line code in deeply.

                  Thanks.