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:18:09 UTC
svn commit: r1395104 - in /ofbiz/trunk/framework/common:
servicedef/services_email.xml src/org/ofbiz/common/email/EmailServices.java
Author: jleroux
Date: Sat Oct 6 16:18:09 2012
New Revision: 1395104
URL: http://svn.apache.org/viewvc?rev=1395104&view=rev
Log:
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/trunk/framework/common/servicedef/services_email.xml
ofbiz/trunk/framework/common/src/org/ofbiz/common/email/EmailServices.java
Modified: ofbiz/trunk/framework/common/servicedef/services_email.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/servicedef/services_email.xml?rev=1395104&r1=1395103&r2=1395104&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/servicedef/services_email.xml (original)
+++ ofbiz/trunk/framework/common/servicedef/services_email.xml Sat Oct 6 16:18:09 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/trunk/framework/common/src/org/ofbiz/common/email/EmailServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/email/EmailServices.java?rev=1395104&r1=1395103&r2=1395104&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/email/EmailServices.java (original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/email/EmailServices.java Sat Oct 6 16:18:09 2012
@@ -157,6 +157,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;
@@ -190,6 +191,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));
}
@@ -227,6 +231,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");