diff --git a/process/DocumentTemplate_lib/process.js b/process/DocumentTemplate_lib/process.js
index 5fef12bb28f9133080c716a9f542a528103792ec..3cebbc9b90c762be74126a8170a59813fad9feec 100644
--- a/process/DocumentTemplate_lib/process.js
+++ b/process/DocumentTemplate_lib/process.js
@@ -65,10 +65,23 @@ DocumentTemplate.prototype.toString = function (pWithSubtemplates)
     if (this._stringCache[stringCachePosition] == null)
     {
         var content = pWithSubtemplates && this._subtemplateResolvedContent || this.content;
-        if (this.type == DocumentTemplate.types.PLAIN)
-            this._stringCache[stringCachePosition] = content;
-        else
-            this._stringCache[stringCachePosition] = text.parseDocument(content);
+        switch(this.type)
+        {
+            case DocumentTemplate.types.EML: //intended fallthrough 
+                if(this.options.onlyBody)
+                {
+                    var email = Email.fromRFC(content);
+                    content = util.encodeBase64String(email.body);
+                }  
+            case DocumentTemplate.types.HTML:
+                this._stringCache[stringCachePosition] = util.decodeBase64String(content);
+                break;
+            case DocumentTemplate.types.PLAIN:
+                this._stringCache[stringCachePosition] = content;
+                break;
+            default:
+                this._stringCache[stringCachePosition] = text.parseDocument(content);
+        }
     }
     return this._stringCache[stringCachePosition];
 }