svn commit: r440795 - /incubator/ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailServices.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r440795 - /incubator/ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailServices.java

sichen
Author: sichen
Date: Wed Sep  6 09:56:59 2006
New Revision: 440795

URL: http://svn.apache.org/viewvc?view=rev&rev=440795
Log:
Content type text/plain emails should not be identified as contentType text/html.

Modified:
    incubator/ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailServices.java

Modified: incubator/ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailServices.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailServices.java?view=diff&rev=440795&r1=440794&r2=440795
==============================================================================
--- incubator/ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailServices.java (original)
+++ incubator/ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailServices.java Wed Sep  6 09:56:59 2006
@@ -307,6 +307,7 @@
         bodyParameters.put("locale", locale);
         String partyId = (String) bodyParameters.get("partyId");
         NotificationServices.setBaseUrl(dctx.getDelegator(), webSiteId, bodyParameters);
+        String contentType = (String) serviceContext.remove("contentType");
 
         StringWriter bodyWriter = new StringWriter();
 
@@ -437,7 +438,14 @@
             } else {
                 serviceContext.put("body", bodyWriter.toString());
             }
-            serviceContext.put("contentType", "text/html");
+
+            // Only override the default contentType in case of plaintext, since other contentTypes may be multipart
+            //    and would require specific handling.
+            if (contentType != null && contentType.equalsIgnoreCase("text/plain")) {
+                serviceContext.put("contentType", "text/plain");
+            } else {
+                serviceContext.put("contentType", "text/html");
+            }
         }
         
         // also expand the subject at this point, just in case it has the FlexibleStringExpander syntax in it...