From 9464408bf98474a7029a4a6b23e6b7276d84b332 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Sun, 5 Jun 2022 19:00:45 +0200 Subject: [PATCH] test mail ok --- .../java/com/covas/Resources/MailRessource.java | 14 +++++++++++--- src/main/resources/application.properties | 7 ++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/covas/Resources/MailRessource.java b/src/main/java/com/covas/Resources/MailRessource.java index ff47261..b87aee6 100644 --- a/src/main/java/com/covas/Resources/MailRessource.java +++ b/src/main/java/com/covas/Resources/MailRessource.java @@ -1,12 +1,17 @@ package com.covas.Resources; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionStage; + import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; +import javax.ws.rs.core.Response; import io.quarkus.mailer.Mail; +import io.quarkus.mailer.Mailer; import io.quarkus.mailer.reactive.ReactiveMailer; -import io.smallrye.mutiny.Uni; + @Path("mail") public class MailRessource { @@ -14,9 +19,12 @@ public class MailRessource { @Inject private ReactiveMailer mail; + @GET - public Uni sendMail(){ - return mail.send(Mail.withText("valcze80@gmail.com", "toto", "toto")); + public CompletionStage sendMail(){ + return mail.send(Mail.withText("valcze80@gmail.com", "async", "toto")) + .subscribeAsCompletionStage() + .thenApply(x -> Response.accepted().build()); } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 69c99b0..efaf00f 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -16,7 +16,8 @@ covas.schema.create = true quarkus.mailer.auth-methods=DIGEST-MD5 CRAM-SHA256 CRAM-SHA1 CRAM-MD5 PLAIN LOGIN quarkus.mailer.from=valczebackup@gmail.com quarkus.mailer.host=smtp.gmail.com -quarkus.mailer.port=465 -quarkus.mailer.ssl=true +quarkus.mailer.port=587 +quarkus.mailer.start-tls=REQUIRED quarkus.mailer.username=valczebackup@gmail.com -quarkus.mailer.password=aohrpmqvxldwyebs \ No newline at end of file +quarkus.mailer.password=aohrpmqvxldwyebs +quarkus.mailer.mock=false \ No newline at end of file