[seam-commits] Seam SVN: r7433 - in trunk: src/mail/org/jboss/seam/mail/ui and 1 other directory.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Mon Feb 18 10:23:50 EST 2008


Author: pete.muir at jboss.org
Date: 2008-02-18 10:23:50 -0500 (Mon, 18 Feb 2008)
New Revision: 7433

Modified:
   trunk/doc/reference/en/modules/mail.xml
   trunk/src/mail/org/jboss/seam/mail/ui/UIMessage.java
Log:
Support for explicit message id

Modified: trunk/doc/reference/en/modules/mail.xml
===================================================================
--- trunk/doc/reference/en/modules/mail.xml	2008-02-18 07:21:56 UTC (rev 7432)
+++ trunk/doc/reference/en/modules/mail.xml	2008-02-18 15:23:50 UTC (rev 7433)
@@ -567,6 +567,11 @@
                 <literal>&lt;h:graphicImage&gt;</literal> in your emails.
               </para>
             </listitem>
+            <listitem>
+              <para>
+                <literal>messageId</literal> &#8212; Sets the Message-ID explicitly
+              </para>
+            </listitem>
           </itemizedlist>
         </listitem>
       </varlistentry>

Modified: trunk/src/mail/org/jboss/seam/mail/ui/UIMessage.java
===================================================================
--- trunk/src/mail/org/jboss/seam/mail/ui/UIMessage.java	2008-02-18 07:21:56 UTC (rev 7432)
+++ trunk/src/mail/org/jboss/seam/mail/ui/UIMessage.java	2008-02-18 15:23:50 UTC (rev 7433)
@@ -1,5 +1,7 @@
 package org.jboss.seam.mail.ui;
 
+import static org.jboss.seam.util.Strings.isEmpty;
+
 import java.io.IOException;
 
 import javax.faces.FacesException;
@@ -45,6 +47,8 @@
    private String urlBase;
    
    private String charset;
+   
+   private String messageId;
 
    /**
     * Get the JavaMail Session to use. If not set the default session is used
@@ -74,7 +78,23 @@
    {
       if (mimeMessage == null)
       {
-         mimeMessage = new MimeMessage(getMailSession());
+         if (!isEmpty(getMessageId()))
+         {
+            mimeMessage = new MimeMessage(getMailSession())
+            {
+               
+               @Override
+               protected void updateMessageID() throws MessagingException
+               {
+                  setHeader("Message-ID", getMessageId());
+               }
+               
+            };
+         }
+         else
+         {
+            mimeMessage = new MimeMessage(getMailSession());
+         }
          Multipart root = new MimeMultipart();
          mimeMessage.setContent(root);
       }
@@ -259,5 +279,22 @@
    {
       this.charset = charset;
    }
+   
+   public String getMessageId()
+   {
+      if (messageId == null)
+      {
+         return getString("messageId");
+      }
+      else
+      {
+         return messageId;
+      }
+   }
+   
+   public void setMessageId(String messageId)
+   {
+      this.messageId = messageId;
+   }
 
 }




More information about the seam-commits mailing list