Author: amilas
Date: Fri Nov 13 02:29:37 2009
New Revision: 835710

URL: http://svn.apache.org/viewvc?rev=835710&view=rev
Log:
solving the gmail problem by setting the message id in <x...@gmail.com> format.

Modified:
    
webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailTransportSender.java
    
webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/WSMimeMessage.java

Modified: 
webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailTransportSender.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailTransportSender.java?rev=835710&r1=835709&r2=835710&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailTransportSender.java
 (original)
+++ 
webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailTransportSender.java
 Fri Nov 13 02:29:37 2009
@@ -249,7 +249,7 @@
                     messageFormatter.getClass().getSimpleName());
         }
 
-        WSMimeMessage message = new WSMimeMessage(session);
+        WSMimeMessage message = new WSMimeMessage(session, 
outInfo.getFromAddress().getAddress());
         Map trpHeaders = (Map) 
msgContext.getProperty(MessageContext.TRANSPORT_HEADERS);
         if (log.isDebugEnabled() && trpHeaders != null) {
             log.debug("Using transport headers: " + trpHeaders);

Modified: 
webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/WSMimeMessage.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/WSMimeMessage.java?rev=835710&r1=835709&r2=835710&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/WSMimeMessage.java
 (original)
+++ 
webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/WSMimeMessage.java
 Fri Nov 13 02:29:37 2009
@@ -38,17 +38,22 @@
  */
 public class WSMimeMessage extends MimeMessage {
     private long bytesSent = -1;
+    private String fromAddress;
 
-    WSMimeMessage(Session session) {
+    WSMimeMessage(Session session, String fromAddress) {
         super(session);
+        this.fromAddress = fromAddress;
     }
 
     @Override
     protected void updateMessageID() throws MessagingException {
+        // although MailConstants.MAIL_HEADER_X_MESSAGE_ID solves the gmail 
problem with axis2-axis2
+        // invocations it is not a generic solution.
+        // we can over come gmail problem by setting the message id as follows 
with a valid gmail address
+        // <x...@gmail.com> this can be achived by appending from address at 
the end of uuid
            if (getHeader(MailConstants.MAIL_HEADER_MESSAGE_ID) == null) {
-            String uuid = UUIDGenerator.getUUID();
+            String uuid = "<" + UUIDGenerator.getUUID().replaceAll(":",".") + 
fromAddress +">";
             setHeader(MailConstants.MAIL_HEADER_MESSAGE_ID, uuid);
-            setHeader(MailConstants.MAIL_HEADER_X_MESSAGE_ID, uuid);
         }
     }
 


Reply via email to