This is an automated email from the ASF dual-hosted git repository.

oscerd pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git


The following commit(s) were added to refs/heads/main by this push:
     new 421e92838 Fix #2957: make the documented mail-sink ce-* headers work; 
drop dead redis-sink mappings (#2964)
421e92838 is described below

commit 421e92838074e4a73b3a058cad749bd9084df2e9
Author: Andrea Cosentino <[email protected]>
AuthorDate: Mon Aug 24 18:39:58 2026 +0200

    Fix #2957: make the documented mail-sink ce-* headers work; drop dead 
redis-sink mappings (#2964)
    
    mail-sink documents ce-subject / ce-from / ce-to / ce-cc as overrides, but
    camel-mail ignores the Subject / From / To / Cc headers unless
    useHeaderSubject / useHeaderFrom / useHeaderRecipients are enabled, and all
    three default to false. The mappings were dead code.
    
    Enable the three options so the documented interface works, and strip the
    bare mail headers first so only the ce-* interface can set them. Bcc and
    Reply-To are not part of that interface and are stripped without a mapping.
    
    redis-sink read ${header[ce-channell]} inside a branch guarded on
    ${header[ce-channel]}, so supplying ce-channel set an empty channel. Fix the
    typo. The value / message choice blocks were unconditionally overwritten by
    the ${body} setHeader steps that follow them; remove them rather than change
    which one wins.
    
    Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
---
 kamelets/mail-sink.kamelet.yaml  | 22 ++++++++++++++++++++++
 kamelets/redis-sink.kamelet.yaml | 26 +-------------------------
 2 files changed, 23 insertions(+), 25 deletions(-)

diff --git a/kamelets/mail-sink.kamelet.yaml b/kamelets/mail-sink.kamelet.yaml
index e699301fb..dff1050bb 100644
--- a/kamelets/mail-sink.kamelet.yaml
+++ b/kamelets/mail-sink.kamelet.yaml
@@ -80,6 +80,21 @@ spec:
     from:
       uri: "kamelet:source"
       steps:
+        # Drop any mail headers arriving from upstream. Only the documented
+        # ce-* interface below is allowed to set them, and Bcc / Reply-To are
+        # not part of that interface at all.
+        - removeHeader:
+            name: Subject
+        - removeHeader:
+            name: From
+        - removeHeader:
+            name: To
+        - removeHeader:
+            name: Cc
+        - removeHeader:
+            name: Bcc
+        - removeHeader:
+            name: Reply-To
         - choice:
             when:
             - simple: "${header[ce-subject]}"
@@ -118,4 +133,11 @@ spec:
               to: "{{to}}"
               username: "{{username}}"
               password: "{{password}}"
+              # camel-mail ignores the Subject / From / To / Cc headers unless
+              # these are enabled; without them the ce-* mappings above are
+              # dead code. Reply-To stays disabled - it is not part of the
+              # documented interface.
+              useHeaderSubject: true
+              useHeaderFrom: true
+              useHeaderRecipients: true
 
diff --git a/kamelets/redis-sink.kamelet.yaml b/kamelets/redis-sink.kamelet.yaml
index 4ed75f8de..75662b367 100644
--- a/kamelets/redis-sink.kamelet.yaml
+++ b/kamelets/redis-sink.kamelet.yaml
@@ -80,30 +80,6 @@ spec:
             - setHeader:
                 name: CamelRedis.Key
                 simple: "${header[ce-key]}"
-      - choice:
-          when:
-          - simple: "${header[value]}"
-            steps:
-            - setHeader:
-                name: CamelRedis.Value
-                simple: "${header[value]}"
-          - simple: "${header[ce-value]}"
-            steps:
-            - setHeader:
-                name: CamelRedis.Value
-                simple: "${header[ce-value]}"
-      - choice:
-          when:
-          - simple: "${header[message]}"
-            steps:
-            - setHeader:
-                name: CamelRedis.Message
-                simple: "${header[message]}"
-          - simple: "${header[ce-message]}"
-            steps:
-            - setHeader:
-                name: CamelRedis.Message
-                simple: "${header[ce-message]}"
       - choice:
           when:
           - simple: "${header[channel]}"
@@ -115,7 +91,7 @@ spec:
             steps:
             - setHeader:
                 name: CamelRedis.Channel
-                simple: "${header[ce-channell]}"
+                simple: "${header[ce-channel]}"
       - setHeader:
           name: CamelRedis.Message
           simple: "${body}"

Reply via email to