This is an automated email from the ASF dual-hosted git repository.
mridulpathak pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/trunk by this push:
new 4b6b36b87f Fixed: sendFailureNotification NPEs on default sendFrom,
masking the original SMTP error (OFBIZ-13477) (#1548)
4b6b36b87f is described below
commit 4b6b36b87fa615b72b1e091a7bc19ef5f0b53c2c
Author: Mridul Pathak <[email protected]>
AuthorDate: Fri Aug 7 11:01:30 2026 +0530
Fixed: sendFailureNotification NPEs on default sendFrom, masking the
original SMTP error (OFBIZ-13477) (#1548)
sendFailureNotification() built its bounce-notification context from the
raw, unresolved context.get("sendFrom") instead of the sendFrom local variable
that sendMail() resolves (with a fallback to general.defaultFromEmailAddress).
When a caller relied on that default, sendFrom/sendTo in the notification
context were both null, causing an NPE in mail.addRecipients() that masked the
original SMTP address failure and rolled back the transaction. This passes the
already-resolved sendFrom [...]
---
.../main/java/org/apache/ofbiz/common/email/EmailServices.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
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 59bf4f594c..d28859843d 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
@@ -362,7 +362,7 @@ public class EmailServices {
}
Boolean sendFailureNotification = (Boolean)
context.get("sendFailureNotification");
if (sendFailureNotification == null || sendFailureNotification) {
- sendFailureNotification(ctx, context, mail, failedAddresses);
+ sendFailureNotification(ctx, context, mail, failedAddresses,
sendFrom);
results.put("messageWrapper", new MimeMessageWrapper(session,
mail));
try {
results.put("messageId", mail.getMessageID());
@@ -687,13 +687,13 @@ public class EmailServices {
return sendMailFromScreen(dctx, serviceContext);
}
public static void sendFailureNotification(DispatchContext dctx,
Map<String, ? extends Object> context, MimeMessage message,
-
List<SMTPAddressFailedException> failures) {
+
List<SMTPAddressFailedException> failures, String sendFrom) {
Locale locale = (Locale) context.get("locale");
Map<String, Object> newContext = new LinkedHashMap<>();
newContext.put("userLogin", context.get("userLogin"));
newContext.put("sendFailureNotification", false);
- newContext.put("sendFrom", context.get("sendFrom"));
- newContext.put("sendTo", context.get("sendFrom"));
+ newContext.put("sendFrom", sendFrom);
+ newContext.put("sendTo", sendFrom);
newContext.put("subject", UtilProperties.getMessage(RESOURCE,
"CommonEmailSendUndeliveredMail", locale));
StringBuilder sb = new StringBuilder();
sb.append(UtilProperties.getMessage(RESOURCE,
"CommonEmailDeliveryFailed", locale));