test mail ok

This commit is contained in:
Valentin CZERYBA 2022-06-05 19:00:45 +02:00
parent a9cafc90da
commit 9464408bf9
2 changed files with 15 additions and 6 deletions

View File

@ -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<Void> sendMail(){
return mail.send(Mail.withText("valcze80@gmail.com", "toto", "toto"));
public CompletionStage<Response> sendMail(){
return mail.send(Mail.withText("valcze80@gmail.com", "async", "toto"))
.subscribeAsCompletionStage()
.thenApply(x -> Response.accepted().build());
}

View File

@ -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
quarkus.mailer.password=aohrpmqvxldwyebs
quarkus.mailer.mock=false