From c339325d30f1395208cacea18391c10efb4d90cf Mon Sep 17 00:00:00 2001 From: Jacques Le Roux Date: Sun, 31 Mar 2019 09:17:06 +0000 Subject: [PATCH] "Applied fix from trunk for revision: 1856667 " ------------------------------------------------------------------------ r1856667 | jleroux | 2019-03-31 11:14:16 +0200 (dim. 31 mars 2019) | 10 lignes Fixed: EmailServices.sendMail causes a NPE, when sendFrom is missing (OFBIZ-10706) I tried to find the history for why the service does not take the defaultFromEmailAddress property from general.properties and I found that It was last modified in revision r418498 on 02/07/2006, I think it was always broken. This uses defaultFromEmailAddress property in sendMail if sendFrom is missing Thanks: Benjanmin Jugl reported, Pawan Verma fixed and others for discussion ------------------------------------------------------------------------ git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release17.12@1856669 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/java/org/apache/ofbiz/common/email/EmailServices.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java b/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java index ae315780c5..0dcacecece 100644 --- a/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java +++ b/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java @@ -156,6 +156,9 @@ public class EmailServices { } String sendFrom = (String) context.get("sendFrom"); + if (UtilValidate.isEmpty(sendFrom)) { + sendFrom = EntityUtilProperties.getPropertyValue("general", "defaultFromEmailAddress", delegator); + } String sendType = (String) context.get("sendType"); String port = (String) context.get("port"); String socketFactoryClass = (String) context.get("socketFactoryClass");