Author: jleroux
Date: Sat Oct 6 17:32:58 2012
New Revision: 1395122
URL: http://svn.apache.org/viewvc?rev=1395122&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/branches/release10.04/framework/common/servicedef/services_email.xml
ofbiz/branches/release10.04/framework/common/src/org/ofbiz/common/email/EmailServices.java
Modified:
ofbiz/branches/release10.04/framework/common/servicedef/services_email.xml
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release10.04/framework/common/servicedef/services_email.xml?rev=1395122&r1=1395121&r2=1395122&view=diff
==============================================================================
--- ofbiz/branches/release10.04/framework/common/servicedef/services_email.xml
(original)
+++ ofbiz/branches/release10.04/framework/common/servicedef/services_email.xml
Sat Oct 6 17:32:58 2012
@@ -37,6 +37,7 @@ under the License.
<attribute name="sendType" 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/release10.04/framework/common/src/org/ofbiz/common/email/EmailServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release10.04/framework/common/src/org/ofbiz/common/email/EmailServices.java?rev=1395122&r1=1395121&r2=1395122&view=diff
==============================================================================
---
ofbiz/branches/release10.04/framework/common/src/org/ofbiz/common/email/EmailServices.java
(original)
+++
ofbiz/branches/release10.04/framework/common/src/org/ofbiz/common/email/EmailServices.java
Sat Oct 6 17:32:58 2012
@@ -153,6 +153,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;
@@ -186,6 +187,9 @@ public class EmailServices {
if (sendPartial == null) {
sendPartial =
UtilProperties.propertyValueEqualsIgnoreCase("general.properties",
"mail.smtp.sendpartial", "true") ? true : false;
}
+ if (isStartTLSEnabled == null) {
+ isStartTLSEnabled =
UtilProperties.propertyValueEqualsIgnoreCase("general.properties",
"mail.smtp.starttls.enable", "true");
+ }
} else if (sendVia == null) {
return ServiceUtil.returnError("Parameter sendVia is required when
sendType is not mail.smtp.host");
}
@@ -223,6 +227,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");