diff --git a/ActiveSync/SOGoActiveSyncDispatcher.m b/ActiveSync/SOGoActiveSyncDispatcher.m
index 1143219..f6ab9f5 100644
--- a/ActiveSync/SOGoActiveSyncDispatcher.m
+++ b/ActiveSync/SOGoActiveSyncDispatcher.m
@@ -1546,15 +1546,50 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   [context setObject: deviceId  forKey: @"DeviceId"];
   [context setObject: [[theRequest uri] deviceType]  forKey: @"DeviceType"];
 
-  d = [[theRequest content] wbxml2xml];
+  cmdName = [[theRequest uri] command];
+
+  //
+  // If the MS-ASProtocolVersion header is set to "12.1", the body of the SendMail request is
+  // is a "message/rfc822" payload - otherwise, it's a WBXML blob.
+  //
+  if ([cmdName caseInsensitiveCompare: @"SendMail"] == NSOrderedSame &&
+      [[theRequest headerForKey: @"content-type"] caseInsensitiveCompare: @"message/rfc822"] == NSOrderedSame)
+    {
+      NSMutableString *myRFC822;
+
+      myRFC822 = [NSMutableString string];
+      
+      if ([[theRequest contentAsString] rangeOfString: @"Date: "
+                                              options: NSCaseInsensitiveSearch].location == NSNotFound)
+        {
+          NSMutableString *myRFC822_x;
+          NSString *value;
+
+          
+          value = [[NSDate date] descriptionWithCalendarFormat: @"%a, %d %b %Y %H:%M:%S %z"  timeZone: [NSTimeZone timeZoneWithName: @"GMT"]  locale: nil];
+          myRFC822_x = [NSMutableString string];
+
+          [myRFC822_x appendFormat: @"Date: %@\n%@", value, [theRequest contentAsString]];
+          [myRFC822  appendFormat: @"<?xml version=\"1.0\"?><!DOCTYPE ActiveSync PUBLIC \"-//MICROSOFT//DTD ActiveSync//EN\" \"http://www.microsoft.com/\"><SendMail xmlns=\"ComposeMail:\"><SaveInSentItems/><MIME>%@</MIME></SendMail>", [myRFC822_x stringByEncodingBase64]];
+        } 
+      else
+        {
+          [myRFC822 appendFormat: @"<?xml version=\"1.0\"?><!DOCTYPE ActiveSync PUBLIC \"-//MICROSOFT//DTD ActiveSync//EN\" \"http://www.microsoft.com/\"><SendMail xmlns=\"ComposeMail:\"><SaveInSentItems/><MIME>%@</MIME></SendMail>", [[theRequest contentAsString ] stringByEncodingBase64]];
+        }
+      
+      d = [myRFC822 dataUsingEncoding: NSASCIIStringEncoding];
+    }
+  else
+    {
+      d = [[theRequest content] wbxml2xml];
+    }
+
   documentElement = nil;
 
   if (!d)
     {
       // We check if it's a Ping command with no body.
-      // See http://msdn.microsoft.com/en-us/library/ee200913(v=exchg.80).aspx for details
-      cmdName = [[theRequest uri] command];
-      
+      // See http://msdn.microsoft.com/en-us/library/ee200913(v=exchg.80).aspx for details      
       if ([cmdName caseInsensitiveCompare: @"Ping"] != NSOrderedSame)
         return [NSException exceptionWithHTTPStatus: 500];
     }
