JiriOndrusek commented on code in PR #3685:
URL: https://github.com/apache/camel-quarkus/pull/3685#discussion_r844752348


##########
integration-tests/mail/src/main/java/org/apache/camel/quarkus/component/mail/CamelRoute.java:
##########
@@ -16,38 +16,215 @@
  */
 package org.apache.camel.quarkus.component.mail;
 
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import java.util.Properties;
+import java.util.concurrent.CopyOnWriteArrayList;
 
+import javax.activation.DataHandler;
+import javax.enterprise.context.ApplicationScoped;
 import javax.enterprise.inject.Produces;
-import javax.mail.Session;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+import javax.json.Json;
+import javax.json.JsonArrayBuilder;
+import javax.json.JsonObjectBuilder;
+import javax.mail.Folder;
+import javax.mail.MessagingException;
 
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
+import org.apache.camel.attachment.AttachmentMessage;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mail.MailComponent;
+import org.apache.camel.component.mail.MailConverters;
+import org.apache.camel.component.mail.MailMessage;
+import org.apache.camel.support.jsse.KeyManagersParameters;
+import org.apache.camel.support.jsse.SSLContextParameters;
+import org.apache.camel.support.jsse.TrustManagersParameters;
+import org.eclipse.microprofile.config.inject.ConfigProperty;
 
+@ApplicationScoped
 public class CamelRoute extends RouteBuilder {
+
+    enum Routes {
+        convertersRoute, batchReceiveRoute, imapReceiveRoute, 
imapsReceiveRoute, pop3ReceiveRoute, pop3sReceiveRoute;
+    }
+
+    @Inject
+    @Named("mailReceivedMessages")
+    List<Map<String, Object>> mailReceivedMessages;
+
+    @Inject
+    CamelContext camelContext;
+
+    static final String EMAIL_ADDRESS = "test@localhost";
+    static final String USERNAME = "test";
+    static final String PASSWORD = "s3cr3t";
+
+    @ConfigProperty(name = "mail.smtp.port")
+    int smtpPort;
+
+    @ConfigProperty(name = "mail.smtps.port")
+    int smtpsPort;
+
+    @ConfigProperty(name = "mail.pop3.port")
+    int pop3Port;
+
+    @ConfigProperty(name = "mail.pop3s.port")
+    int pop3sPort;
+
+    @ConfigProperty(name = "mail.imap.port")
+    int imapPort;
+
+    @ConfigProperty(name = "mail.imaps.port")
+    int imapsPort;
+
     @Override
     public void configure() {
-        bindToRegistry("smtp", smtp());
 
-        from("direct:mailtext")
-                .setHeader("Subject", constant("Hello World"))
-                .setHeader("To", constant("james@localhost"))
-                .setHeader("From", constant("claus@localhost"))
-                .to("smtp://localhost?initialDelay=100&delay=100");
+        from("direct:sendMail")
+                .toF("smtp://localhost:%d?username=%s&password=%s", smtpPort, 
USERNAME, PASSWORD);
+
+        from("direct:sendMailSecured").toF(

Review Comment:
   I probably don't get it. As far as I know the mail could be send only via 
`smtp` (`smtps`) and received via `pop3` and `impa`.
   Therefore producer can be used only with smtp. (I locally tried to send 
email with pop3 and imap, and got `javax.mail.MessagingException: Got bad 
greeting from SMTP host` in baoth cases - because I use ports not for smtp). Do 
I understand it wrong? (producer is tested with smtp/smtps and consumer with 
pop3/pop3s and imap/imaps)



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to