4 Replies Latest reply on Feb 8, 2007 6:21 AM by Pete Muir

    Seam Mail -Error trying to send multiple mails

    Ricardo Memoria Novice

      Hi all,

      I have an app where it sends new passworda for the users selected. Since each user has it's own password, I have to send one message for eachone selected.

      The code is quite simple. The page action is the method sendNewPassword()

      @Stateful
      @Scope(ScopeType.CONVERSATION)
      @Name("users")
      public class UsersBean implements com.rmemoria.mdrtb.seam.UsersLocal {
      
       @DataModel
       private List<ItemSelect> userList;
      
       @In(create=true) @Out
       private User user;
      
       private String password;
      
       @DataModelSelection
       @Out(required=false)
       private ItemSelect itemSelect;
      
       @In
       private Context conversationContext;
      
       @PersistenceContext(type=PersistenceContextType.EXTENDED)
       private EntityManager em;
      
       @EJB
       private UsersSrvLocal usersSrv;
      
       @In
       private FacesMessages facesMessages;
      
       public void sendMail(String mailPage) {
       try
       {
       renderer.render(mailPage);
       facesMessages.add("Email enviado com sucesso");
       } catch (Exception e) {
       e.printStackTrace();
       facesMessages.add("Erro ao enviar e-mail ");
       }
       }
      
       public void sendNewPassword() {
       List<User> lst = ItemSelectHelper.createItemsList(userList, true);
      
       for (int i = 0; i < lst.size(); i++) {
       User usu = lst.get(i);
       password = usersSrv.generatePassword();
       usu.setPassword( usersSrv.hashPassword(password) );
       em.persist(usu);
      
       conversationContext.set("user", usu);
       sendMail("/mail/newpassword.xhtml");
       }
      
       facesMessages.add(new FacesMessage("passwords were sent successfully"));
       }


      And the mail page is

      <!-- <?xml version="1.0" encoding="UTF-8"?> -->
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       template="usertemplate.xhtml">
      
       <ui:param name="subject" value="New password" />
      
       <ui:define name="body">
      
       <h3>New Password</h3><p/>
       Hi #{user.full_name}<p/>
      
       <table border="0" cellpadding="4" style="font-size:10px;font-name:Courier New;">
       <tr><td>User account:</td><td>#{user.login}</td></tr>
       <tr><td>Password:</td><td>#{users.password}</td></tr>
       </table>
      
       </ui:define>
      
      </ui:composition>


      and usertemplate.xhtml

      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:s="http://jboss.com/products/seam/taglib"
       xmlns:m="http://jboss.com/products/seam/mail"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core">
      
       <m:message>
       <m:from address="suporte@rmemoria.com.br" />
       <m:to name="#{user.full_name}">#{user.email}</m:to>
       <m:subject>MDR-TB System - #{subject}</m:subject>
      
       <m:body>
       <html>
       <body>
       <span style="font-family:Verdana,Arial,Sans Serif;font-size:10px;">
       <b>MDR-TB System</b>
       <br/>
       <ui:insert name="body">
       This is the default body, specified by the template.
       </ui:insert>
       <p/>
       To login just access
       <a href="http://www.tbmr.rmemoria.com.br">http://www.tbmr.rmemoria.com.br</a>.<p/>
       <p/>
       Regards,<br/>
       MDR-TB System Administrator
       </span>
       <p/>
       </body>
       </html>
       <f:facet name="alternative">
       <ui:insert name="alternative">
       <h:outputText>Sorry, your mail reader doesn't support html.</h:outputText>
       </ui:insert>
       </f:facet>
       </m:body>
      </m:message>
      </ui:composition>


      If I select 1 user the system sends the message.

      If I select more than 1 user the system sends the first message but the second it raises the following exception:

      20:28:35,906 ERROR [STDERR] javax.faces.FacesException: Email cannot have more than one from address(suporte@rmemoria.com.br)
      20:28:35,906 ERROR [STDERR] at org.jboss.seam.mail.ui.UIFrom.encodeBegin(UIFrom.java:31)
      20:28:35,906 ERROR [STDERR] at org.jboss.seam.ui.JSF.renderChild(JSF.java:171)
      20:28:35,906 ERROR [STDERR] at org.jboss.seam.ui.JSF.renderChildren(JSF.java:162)
      20:28:35,906 ERROR [STDERR] at org.jboss.seam.ui.JSF.renderChild(JSF.java:177)
      20:28:35,906 ERROR [STDERR] at org.jboss.seam.ui.JSF.renderChildren(JSF.java:162)
      20:28:35,906 ERROR [STDERR] at org.jboss.seam.ui.facelet.FaceletsRenderer.renderFacelet(FaceletsRenderer.java:105)
      20:28:35,906 ERROR [STDERR] at org.jboss.seam.ui.facelet.FaceletsRenderer.render(FaceletsRenderer.java:53)
      20:28:35,906 ERROR [STDERR] at org.jboss.seam.ui.facelet.FaceletsRenderer.render(FaceletsRenderer.java:38)
      20:28:35,906 ERROR [STDERR] at com.rmemoria.mdrtb.seam.UsersBean.sendMail(UsersBean.java:136)
      20:28:35,906 ERROR [STDERR] at com.rmemoria.mdrtb.seam.UsersBean.sendNewPassword(UsersBean.java:178)
      20:28:35,906 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      20:28:35,906 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      20:28:35,906 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      20:28:35,906 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
      20:28:35,906 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
      20:28:35,906 ERROR [STDERR] at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
      20:28:35,906 ERROR [STDERR] at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:37)
      20:28:35,906 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:55)
      20:28:35,906 ERROR [STDERR] at org.jboss.seam.interceptors.BijectionInterceptor.bijectNonreentrantComponent(BijectionInterceptor.java:79)
      20:28:35,906 ERROR [STDERR] at org.jboss.seam.interceptors.BijectionInterceptor.bijectComponent(BijectionInterceptor.java:58)
      20:28:35,906 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      20:28:35,906 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      20:28:35,906 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      20:28:35,906 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
      20:28:35,906 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
      20:28:35,906 ERROR [STDERR] at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
      20:28:35,906 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
      20:28:35,906 ERROR [STDERR] at org.jboss.seam.interceptors.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:36)
      20:28:35,906 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      20:28:35,906 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      20:28:35,906 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      20:28:35,906 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
      20:28:35,906 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
      20:28:35,906 ERROR [STDERR] at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
      20:28:35,906 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
      20:28:35,906 ERROR [STDERR] at org.jboss.seam.interceptors.OutcomeInterceptor.interceptOutcome(OutcomeInterceptor.java:21)
      20:28:35,906 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      20:28:35,906 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      20:28:35,906 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      20:28:35,906 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
      20:28:35,906 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
      20:28:35,906 ERROR [STDERR] at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
      20:28:35,906 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
      20:28:35,906 ERROR [STDERR] at org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:52)
      20:28:35,906 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      20:28:35,906 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      20:28:35,906 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      20:28:35,906 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
      20:28:35,906 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
      20:28:35,906 ERROR [STDERR] at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
      20:28:35,906 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
      20:28:35,906 ERROR [STDERR] at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
      20:28:35,906 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      20:28:35,906 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      20:28:35,906 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      20:28:35,906 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
      20:28:35,906 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
      20:28:35,906 ERROR [STDERR] at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
      20:28:35,906 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
      20:28:35,906 ERROR [STDERR] at org.jboss.seam.intercept.RootInterceptor.createSeamInvocationContext(RootInterceptor.java:144)
      20:28:35,953 ERROR [STDERR] at org.jboss.seam.intercept.RootInterceptor.invokeInContexts(RootInterceptor.java:129)
      20:28:35,953 ERROR [STDERR] at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:102)
      20:28:35,953 ERROR [STDERR] at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
      20:28:35,953 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      20:28:35,953 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      20:28:36,453 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      20:28:36,453 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
      20:28:36,453 ERROR [STDERR] at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
      20:28:36,453 ERROR [STDERR] at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
      20:28:36,453 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      20:28:36,953 ERROR [STDERR] at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:71)
      20:28:36,953 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      20:28:36,953 ERROR [STDERR] at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
      20:28:36,953 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      20:28:37,453 ERROR [STDERR] at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:46)
      20:28:37,453 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      20:28:37,453 ERROR [STDERR] at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
      20:28:37,453 ERROR [STDERR] at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
      20:28:37,453 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      20:28:37,953 ERROR [STDERR] at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
      20:28:37,953 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      20:28:37,953 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:83)
      20:28:37,953 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      20:28:37,953 ERROR [STDERR] at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
      20:28:38,453 ERROR [STDERR] at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)
      20:28:38,453 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      20:28:38,453 ERROR [STDERR] at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
      20:28:38,453 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      20:28:38,453 ERROR [STDERR] at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
      20:28:38,453 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      20:28:38,453 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:203)
      20:28:38,453 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)
      20:28:38,453 ERROR [STDERR] at $Proxy140.sendNewPassword(Unknown Source)
      20:28:38,453 ERROR [STDERR] at com.rmemoria.mdrtb.seam.UsersLocal$$FastClassByCGLIB$$6569facb.invoke(<generated>)
      20:28:38,453 ERROR [STDERR] at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
      20:28:38,453 ERROR [STDERR] at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:45)
      20:28:38,453 ERROR [STDERR] at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:74)
      20:28:38,453 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:55)
      20:28:38,453 ERROR [STDERR] at org.jboss.seam.interceptors.RemoveInterceptor.removeIfNecessary(RemoveInterceptor.java:40)
      20:28:38,453 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      20:28:38,453 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      20:28:38,453 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      20:28:38,453 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
      20:28:38,453 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
      20:28:38,453 ERROR [STDERR] at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
      20:28:38,453 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
      20:28:38,453 ERROR [STDERR] at org.jboss.seam.interceptors.ExceptionInterceptor.handleExceptions(ExceptionInterceptor.java:39)
      20:28:38,453 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      20:28:38,453 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      20:28:38,453 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      20:28:38,453 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
      20:28:38,453 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
      20:28:38,453 ERROR [STDERR] at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
      20:28:38,453 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
      20:28:38,453 ERROR [STDERR] at org.jboss.seam.intercept.RootInterceptor.createSeamInvocationContext(RootInterceptor.java:144)
      20:28:38,453 ERROR [STDERR] at org.jboss.seam.intercept.RootInterceptor.invokeInContexts(RootInterceptor.java:129)
      20:28:38,453 ERROR [STDERR] at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:102)
      20:28:38,453 ERROR [STDERR] at org.jboss.seam.intercept.ClientSideInterceptor.interceptInvocation(ClientSideInterceptor.java:83)
      20:28:38,453 ERROR [STDERR] at org.jboss.seam.intercept.ClientSideInterceptor.intercept(ClientSideInterceptor.java:52)
      20:28:38,453 ERROR [STDERR] at org.jboss.seam.intercept.Proxy$$EnhancerByCGLIB$$1b1db64.sendNewPassword(<generated>)
      20:28:38,453 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      20:28:38,453 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      20:28:38,453 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      20:28:38,453 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
      20:28:38,453 ERROR [STDERR] at com.sun.el.parser.AstValue.invoke(AstValue.java:151)
      20:28:38,453 ERROR [STDERR] at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
      20:28:38,453 ERROR [STDERR] at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
      20:28:38,453 ERROR [STDERR] at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
      20:28:38,453 ERROR [STDERR] at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
      20:28:38,453 ERROR [STDERR] at javax.faces.component.UICommand.broadcast(UICommand.java:106)
      20:28:38,453 ERROR [STDERR] at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:94)
      20:28:38,453 ERROR [STDERR] at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:168)
      20:28:38,453 ERROR [STDERR] at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:343)
      20:28:38,453 ERROR [STDERR] at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
      20:28:38,453 ERROR [STDERR] at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
      20:28:38,453 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      20:28:38,453 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      20:28:38,453 ERROR [STDERR] at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:46)
      20:28:38,453 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      20:28:38,453 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      20:28:38,453 ERROR [STDERR] at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:32)
      20:28:38,453 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      20:28:38,453 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      20:28:38,453 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      20:28:38,453 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      20:28:38,453 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      20:28:38,453 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      20:28:38,453 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      20:28:38,453 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
      20:28:38,453 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
      20:28:38,453 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      20:28:38,453 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      20:28:38,453 ERROR [STDERR] at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
      20:28:38,453 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      20:28:38,453 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      20:28:38,453 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      20:28:38,453 ERROR [STDERR] at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      20:28:38,453 ERROR [STDERR] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      20:28:38,453 ERROR [STDERR] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      20:28:38,453 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
      20:28:38,453 ERROR [STDERR] Caused by: javax.mail.internet.AddressException: Email cannot have more than one from address in string ``suporte@rmemoria.com.br''
      20:28:38,484 ERROR [STDERR] at org.jboss.seam.mail.ui.UIFrom.encodeBegin(UIFrom.java:25)
      20:28:38,484 ERROR [STDERR] ... 159 more


      Is this my mistake or a bug?

      Ricardo Memória


        • 1. Re: Seam Mail -Error trying to send multiple mails
          Pete Muir Master

          Can you put a bug report in JIRA?

          • 2. Re: Seam Mail -Error trying to send multiple mails
            Pete Muir Master

            Actually, I've fixed this in CVS, can you test please.

            • 3. Re: Seam Mail -Error trying to send multiple mails
              Ricardo Memoria Novice

              Hi,

              I've downloaded from the CVS repository according to structions at http://wiki.jboss.org/wiki/Wiki.jsp?page=SeamRepository

              I've generated and redeployed the app.

              Now the error has changed. Follows partial log:

              10:43:54,359 ERROR [STDERR] javax.faces.FacesException: Illegal character in domain (ricardo@rmemoria.com.brrmemoria@terra.com.br)
              10:43:54,359 ERROR [STDERR] at org.jboss.seam.mail.ui.RecipientAddressComponent.encodeBegin(RecipientAddressComponent.java:29)
              10:43:54,359 ERROR [STDERR] at org.jboss.seam.ui.JSF.renderChild(JSF.java:341)
              10:43:54,359 ERROR [STDERR] at org.jboss.seam.ui.JSF.renderChildren(JSF.java:323)
              10:43:54,359 ERROR [STDERR] at org.jboss.seam.ui.JSF.renderChild(JSF.java:353)
              10:43:54,359 ERROR [STDERR] at org.jboss.seam.ui.JSF.renderChildren(JSF.java:323)
              10:43:54,359 ERROR [STDERR] at org.jboss.seam.ui.facelet.FaceletsRenderer.renderFacelet(FaceletsRenderer.java:105)
              10:43:54,359 ERROR [STDERR] at org.jboss.seam.ui.facelet.FaceletsRenderer.render(FaceletsRenderer.java:53)


              As before, the first message is sent but in the second the system raises this exception.

              If you need the whole stack trace just let me know.

              Ricardo Memória

              • 4. Re: Seam Mail -Error trying to send multiple mails
                Pete Muir Master

                Sorry for the delay in getting back on this.

                Renderer.render ISN'T resetting the tree each time it is called (within the same action method), so, each time you call it elements are added to existing tree. I'll need to talk to Norman about this.

                Anyway, there is, IMO a neater way to do this, which does work :)

                @Stateful
                @Scope(ScopeType.CONVERSATION)
                @Name("users")
                public class UsersBean implements com.rmemoria.mdrtb.seam.UsersLocal {
                
                public void sendNewPassword()
                {
                 List<User> lst = ItemSelectHelper.createItemsList(userList, true);
                 ...
                 Contexts.getEventContext().set("selectedUsers", lst);
                 sendMail("/mail/newpassword.xhtml");
                 ...
                 }


                <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                 xmlns:ui="http://java.sun.com/jsf/facelets"
                 xmlns:s="http://jboss.com/products/seam/taglib"
                 xmlns:m="http://jboss.com/products/seam/mail"
                 xmlns:h="http://java.sun.com/jsf/html"
                 xmlns:f="http://java.sun.com/jsf/core">
                <ui:repeat value="#{selectedUsers}" var="user">
                 <m:message>
                 <m:from address="suporte@rmemoria.com.br" />
                 <m:to name="#{user.full_name}">#{user.email}</m:to>
                 <m:subject>MDR-TB System - #{subject}</m:subject>
                 ...
                 </m:message>
                </ui:repeat>
                </ui:composition>