1 Reply Latest reply on Oct 2, 2009 4:14 AM by yahawari

    HTML email message

    aislam
      Hello,

      I'm really new to SEAM/JSF stuff. I'm trying to implement email sending capability in SEAM. I would like to compose an email in html, but the format of the email is dynamic. I'm trying to get the message body through EL, but would like the message to be sent in formatted html. Here is part of my code block.

      Email template: test.xhtml

      <m:message xmlns="http://www.w3.org/1999/xhtml"
           xmlns:m="http://jboss.com/products/seam/mail"
           xmlns:h="http://java.sun.com/jsf/html"
           xmlns:ui="http://java.sun.com/jsf/facelets"
           importance="normal">
           <m:header name="X-Composed-By" value="JBoss Seam"/>
           <m:from address="#{emailDirector.sender}"/>
           <m:to>somebody@earth.com</m:to>
           <ui:repeat value="#{emailDirector.bccList}" var="bcc">
                <m:bcc>#{bcc.displayName}</m:bcc>
           </ui:repeat>
           <m:subject>Email Director Test</m:subject>
           <m:body>#{emailDirector.message}</m:body>
      </m:message>






      The getMessage in EmailDirector component -


      `public String getMessage() {
              return "<html><body><p>This is a test email from PC Email Director implemented in SEAM way! It seems to work wonderfully!!</p>" +
                        "<p>Please reply to <b>me</b> if you get this email. Thank you!</p>" +
                        "<p>Joe</p></body></html>";       
          }`


      It sends an email with all the html tag. Is there any way I can get the html formatted message, where I supply the format through EL.

      Thanks much for your help.

      Arif

        • 1. Re: HTML email message
          yahawari

          try to change this


          <m:body>#{emailDirector.message}</m:body>
          



          to this


          <m:body>
           <h:output value="#{emailDirector.message}" escape ="fasle"/> 
          </m:body>