You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2012/10/06 18:19:12 UTC

svn commit: r1395106 - in /ofbiz/branches/release12.04: ./ framework/common/servicedef/services_email.xml framework/common/src/org/ofbiz/common/email/EmailServices.java

Author: jleroux
Date: Sat Oct  6 16:19:11 2012
New Revision: 1395106

URL: http://svn.apache.org/viewvc?rev=1395106&view=rev
Log:
"Applied fix from trunk for revision: 1395104  " 
------------------------------------------------------------------------
r1395104 | jleroux | 2012-10-06 18:18:09 +0200 (sam., 06 oct. 2012) | 5 lines

A patch from Varun Bhansaly "Email configuration - mail.smtp.starttls.enable ignored" https://issues.apache.org/jira/browse/OFBIZ-4943

The email configuration setting mail.smtp.starttls.enable is ignored by the system.
I encountered this while configuring OFBiz an email server which had TLS enabled.

------------------------------------------------------------------------


Modified:
    ofbiz/branches/release12.04/   (props changed)
    ofbiz/branches/release12.04/framework/common/servicedef/services_email.xml
    ofbiz/branches/release12.04/framework/common/src/org/ofbiz/common/email/EmailServices.java

Propchange: ofbiz/branches/release12.04/
------------------------------------------------------------------------------
  Merged /ofbiz/trunk:r1395104

Modified: ofbiz/branches/release12.04/framework/common/servicedef/services_email.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/common/servicedef/services_email.xml?rev=1395106&r1=1395105&r2=1395106&view=diff
==============================================================================
--- ofbiz/branches/release12.04/framework/common/servicedef/services_email.xml (original)
+++ ofbiz/branches/release12.04/framework/common/servicedef/services_email.xml Sat Oct  6 16:19:11 2012
@@ -41,6 +41,7 @@ under the License.
         <attribute name="socketFactoryFallback" type="String" mode="IN" optional="true"/>        
         <attribute name="sendFailureNotification" mode="IN" type="Boolean" optional="true"/>
         <attribute name="sendPartial" mode="IN" type="Boolean" optional="true"/>
+        <attribute name="startTLSEnabled" mode="IN" type="Boolean" optional="true"/>
         <attribute name="subject" type="String" mode="INOUT" optional="true" allow-html="safe"/>
         <attribute name="contentType" type="String" mode="INOUT" optional="true"/>
         <attribute name="partyId" type="String" mode="INOUT" optional="true"/>

Modified: ofbiz/branches/release12.04/framework/common/src/org/ofbiz/common/email/EmailServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/common/src/org/ofbiz/common/email/EmailServices.java?rev=1395106&r1=1395105&r2=1395106&view=diff
==============================================================================
--- ofbiz/branches/release12.04/framework/common/src/org/ofbiz/common/email/EmailServices.java (original)
+++ ofbiz/branches/release12.04/framework/common/src/org/ofbiz/common/email/EmailServices.java Sat Oct  6 16:19:11 2012
@@ -158,6 +158,7 @@ public class EmailServices {
         String messageId = (String) context.get("messageId");
         String contentType = (String) context.get("contentType");
         Boolean sendPartial = (Boolean) context.get("sendPartial");
+        Boolean isStartTLSEnabled = (Boolean) context.get("startTLSEnabled");
 
         boolean useSmtpAuth = false;
 
@@ -191,6 +192,9 @@ public class EmailServices {
             if (sendPartial == null) {
                 sendPartial = EntityUtilProperties.propertyValueEqualsIgnoreCase("general.properties", "mail.smtp.sendpartial", "true", delegator) ? true : false;
             }
+            if (isStartTLSEnabled == null) {
+                isStartTLSEnabled = EntityUtilProperties.propertyValueEqualsIgnoreCase("general.properties", "mail.smtp.starttls.enable", "true", delegator);
+            }
         } else if (sendVia == null) {
             return ServiceUtil.returnError(UtilProperties.getMessage(resource, "CommonEmailSendMissingParameterSendVia", locale));
         }
@@ -228,6 +232,9 @@ public class EmailServices {
             if (sendPartial != null) {
                 props.put("mail.smtp.sendpartial", sendPartial ? "true" : "false");
             }
+            if (isStartTLSEnabled) {
+                props.put("mail.smtp.starttls.enable", "true");
+            }
 
             session = Session.getInstance(props);
             boolean debug = UtilProperties.propertyValueEqualsIgnoreCase("general.properties", "mail.debug.on", "Y");