You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2022/11/25 08:28:24 UTC

[camel-kamelets] branch main updated: Fix mail-sink Kamelet

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

acosentino 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 76ca5559 Fix mail-sink Kamelet
76ca5559 is described below

commit 76ca5559a7b7f8f7cc43c3ea794f8ed6abcb5aa0
Author: Christoph Deppisch <cd...@redhat.com>
AuthorDate: Thu Nov 24 21:22:14 2022 +0100

    Fix mail-sink Kamelet
    
    - In fact mail-sink only supports smtp protocol. Others like pop3 and imap do not make sense for sending mails
    - SMTPS protocol is also not supported because SSL context is missing
    - to:{{protocol}} stopped working with latest versions so remove protocol property and always use "smtp"
    - Also fix YAKS test
---
 kamelets/mail-sink.kamelet.yaml                           | 15 +++++++++------
 .../src/main/resources/kamelets/mail-sink.kamelet.yaml    | 15 +++++++++------
 test/mail-sink/mail-sink.feature                          |  7 ++++---
 3 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/kamelets/mail-sink.kamelet.yaml b/kamelets/mail-sink.kamelet.yaml
index 42a7e506..6795f409 100644
--- a/kamelets/mail-sink.kamelet.yaml
+++ b/kamelets/mail-sink.kamelet.yaml
@@ -36,11 +36,6 @@ spec:
       - password
     type: object
     properties:
-      protocol:
-        description: The mail protocol to use
-        default: smtp
-        title: Protocol
-        type: string
       connectionHost:
         description: The mail server host
         example: smtp.gmail.com
@@ -115,4 +110,12 @@ spec:
                     simple: "${header[ce-cc]}"
         - remove-headers:
             pattern: "ce-*"
-        - to: '{{protocol}}://{{connectionHost}}:{{connectionPort}}?subject={{subject}}&from={{from}}&to={{to}}&username={{username}}&password={{password}}'
+        - to:
+            uri: "smtp:{{connectionHost}}:{{connectionPort}}"
+            parameters:
+              subject: "{{subject}}"
+              from: "{{from}}"
+              to: "{{to}}"
+              username: "{{username}}"
+              password: "{{password}}"
+
diff --git a/library/camel-kamelets/src/main/resources/kamelets/mail-sink.kamelet.yaml b/library/camel-kamelets/src/main/resources/kamelets/mail-sink.kamelet.yaml
index 42a7e506..6795f409 100644
--- a/library/camel-kamelets/src/main/resources/kamelets/mail-sink.kamelet.yaml
+++ b/library/camel-kamelets/src/main/resources/kamelets/mail-sink.kamelet.yaml
@@ -36,11 +36,6 @@ spec:
       - password
     type: object
     properties:
-      protocol:
-        description: The mail protocol to use
-        default: smtp
-        title: Protocol
-        type: string
       connectionHost:
         description: The mail server host
         example: smtp.gmail.com
@@ -115,4 +110,12 @@ spec:
                     simple: "${header[ce-cc]}"
         - remove-headers:
             pattern: "ce-*"
-        - to: '{{protocol}}://{{connectionHost}}:{{connectionPort}}?subject={{subject}}&from={{from}}&to={{to}}&username={{username}}&password={{password}}'
+        - to:
+            uri: "smtp:{{connectionHost}}:{{connectionPort}}"
+            parameters:
+              subject: "{{subject}}"
+              from: "{{from}}"
+              to: "{{to}}"
+              username: "{{username}}"
+              password: "{{password}}"
+
diff --git a/test/mail-sink/mail-sink.feature b/test/mail-sink/mail-sink.feature
index 0de2f362..fb4d942f 100644
--- a/test/mail-sink/mail-sink.feature
+++ b/test/mail-sink/mail-sink.feature
@@ -28,15 +28,16 @@ Feature: Mail Sink
       | message   | Camel K rocks |
 
   Scenario: Create mail server
-    Given load endpoint mail-server.groovy
+    Given HTTP server "mail-server"
+    Given HTTP server listening on port 22222
     Given create Kubernetes service mail-server with port mapping 25:22222
+    And stop HTTP server
+    Given load endpoint mail-server.groovy
 
   Scenario: Create Camel K resources
     Given Camel K resource polling configuration
       | maxAttempts          | 200   |
       | delayBetweenAttempts | 2000  |
-    Given Kamelet mail-sink is available
-    Given Kamelet timer-source is available
     Given load KameletBinding timer-to-mail.yaml
     And Camel K integration timer-to-mail should be running
     And Camel K integration timer-to-mail should print Routes startup