Asraf-Uddin-Ahmed opened a new issue, #480:
URL: https://github.com/apache/camel-karavan/issues/480

   I can send mail through `SMTPS`. But, unable to attach any file with the 
mail. Although the code below compiles fine, but I am getting mail without 
attachments. The _Java_ version of the following flow is working alright. I 
can't figure out what's wrong I did in the _Karavan_ conversion. 
   
   This is my `flow`:
   ```
   apiVersion: camel.apache.org/v1
   kind: Integration
   metadata:
     name: mail-with-attachment
   spec:
     flows:
       - route:
           from:
             uri: timer:test
             steps:
               - pollEnrich:
                   expression:
                     simple:
                       expression: file:file_src?noop=true
               - log:
                   message: 'polled: ${body}'
               - setBody:
                   expression:
                     exchangeProperty:
                       expression: |-
                         exchange -> {
                             byte[] fileBytes = 
exchange.getIn().getBody(byte[].class);
                             org.apache.camel.attachment.AttachmentMessage 
attMsg = exchange.getIn(org.apache.camel.attachment.AttachmentMessage.class);
                             attMsg.addAttachment("report.pdf", new 
DataHandler(fileBytes, "application/pdf"));
                             return exchange.getMessage().getBody();
                         }
               - setHeader:
                   name: subject
                   expression:
                     simple:
                       expression: Test subject from Karavan
               - setHeader:
                   name: to
                   expression:
                     simple:
                       expression: '{{mail.to}}'
               - setBody:
                   expression:
                     constant:
                       expression: >-
                         Hello,<br>This is test body from Karavan with an
                         attachment.
               - log:
                   message: 'PDF_SENDER_ROUTE: mail body: ${body}'
               - toD:
                   uri: >-
                     
smtps://{{mail.host}}:{{mail.port}}?password={{mail.password}}&username={{mail.username}}&contentType={{mail.content-type}}
               - log:
                   message: 'PDF_SENDER_ROUTE: Mail Sent'
                   loggingLevel: ERROR
             parameters:
               delay: '1000'
               period: '10000'
   ```
   This is my `properties` file:
   ```
   camel.jbang.project-id=mail_with_attachment
   camel.jbang.project-name=mail_with_attachment
   camel.jbang.project-description=mail_with_attachment
   camel.jbang.gav=org.demo:mail-with-attachment:1.0
   camel.jbang.runtime=quarkus
   
camel.jbang.dependencies=mvn:io.quarkus:quarkus-container-image-jib,camel:microprofile-health,mvn:io.quarkus:quarkus-openshift,camel:file,camel:mail
   camel.health.enabled=true
   camel.health.exposure-level=full
   camel.jbang.quarkusVersion=2.11.2.Final
   quarkus.kubernetes-client.trust-certs=true
   quarkus.container-image.builder=jib
   quarkus.container-image.group=karavan
   quarkus.container-image.name=mail_with_attachment
   quarkus.openshift.route.expose=false
   quarkus.openshift.part-of=mail_with_attachment
   quarkus.openshift.replicas=1
   
   mail.content-type=text/html
   mail.from=<username>@gmail.com
   mail.password=<password>
   mail.username=<username>@gmail.com
   mail.host=smtp.gmail.com
   mail.port=465
   mail.to=<to-mail>@gmail.com
   ```
   **Note:** All files in `file_src` folder are _PDF_
   
   **Java Version: 11
   Camel Version: 3.18.2
   Karavan Version: 3.18.2**
   
   **Run command:** `jbang -Dcamel.jbang.version=3.18.2 camel@apache/camel run 
*`
   
   I need some assistance. Please help.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to