3 Replies Latest reply on Oct 12, 2011 1:44 PM by rogermorituesta.rogermori.yahoo.com

    Send mails with richtext...

    chucho013

      Hi guys..


      I'm trying to send emails from my app but the condition is the content should have format from
      a rich:editor.  I mean, I'm using this for get the text message:




      <rich:editor value="#{sendMessage.text}" theme="advanced" viewMode="visual" 
         plugins="save,paste" width="600" height="400">
         <f:param name="theme_advanced_toolbar_location" value="top"/>                               
         <f:param name="theme_advanced_toolbar_align" value="left"/>
         <f:param name="theme_advanced_buttons1_add" value="fontsize"/>     
         <f:param name="theme_advanced_buttons2_add_before" value="cut,copy,paste,pasteword,|" />
      </rich:editor>



      in the editor I write for instance this in HTML:


      <p>hola como estas cabronsito <span style="font-size:18px;"><strong>llamado orlando</strong></span></p>



      and this appear like this:


      hola como estas cabronsito llamado orlando



      And after click the send botton I do this:




      public String send(){
           Map<String, Object> map = new HashMap<String, Object>();
           for(Cliente cliente :clientes){
                   map.put("info", cliente);
                map.put("msg", this);
                emailService.sendMessage(10000, "/crm/email/msgcrm.xhtml", map);
           }
           return "sent";
      }



      public class EmailService {
      
           @In(create = true)
           private Renderer renderer;
      
           @Asynchronous
           public void sendMessage(@Duration long delay, String template,
                     Map<String, Object> items) {
                try {
                     for (java.util.Map.Entry<String, Object> item : items.entrySet()) {
                          Contexts.getEventContext().set(item.getKey(), item.getValue());
                     }
                     renderer.render(template);
                } catch (Exception e) {
                     e.printStackTrace();
                }
           }
      
      }



      Fnally I use my msgcrm.xhtml:


      <m:message xmlns="http://www.w3.org/1999/xhtml"
           xmlns:rich="http://richfaces.org/rich"
           xmlns:m="http://jboss.com/products/seam/mail" importance="normal">
           <m:header name="X-Composed-By" value="KubeKit" />
           <m:from name="SAINV" address="ing.jesusduarte@gmail.com" />
           <m:to name="#{info.fullName}">#{info.email}</m:to>
           <m:subject>#{app.mail_subject}</m:subject>
           <m:body>
                #{msg.text}
           </m:body>
      </m:message>



      But obviously my message does not appear in html format, just arrive this:


      <p>hola como estas cabronsito <span style="font-size:18px;"><strong>llamado orlando</strong></span></p>



      I HOPE YOU UNDERSTAND WHAT I'M TRYING TO SAY, I would the same text that I introduce in the 'rich:editor' with its format appear in the emails, someone know how to do this?? I really appreciate all the help you can offer me...