From 9f36abe2c55ea91f4549f27fbf1216bafed450a8 Mon Sep 17 00:00:00 2001 From: Jacques Le Roux Date: Sun, 31 Mar 2019 09:14:16 +0000 Subject: [PATCH] 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/trunk@1856667 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 08fa702bf9..7839551652 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 @@ -160,6 +160,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");