template mail

This commit is contained in:
Valentin CZERYBA 2022-06-06 19:58:07 +02:00
parent 9464408bf9
commit 4dedad4528
3 changed files with 14 additions and 4 deletions

View File

@ -72,6 +72,10 @@
<groupId>io.quarkus</groupId> <groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-mutiny</artifactId> <artifactId>quarkus-resteasy-mutiny</artifactId>
</dependency> </dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-qute</artifactId>
</dependency>
<dependency> <dependency>
<groupId>io.quarkus</groupId> <groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId> <artifactId>quarkus-junit5</artifactId>

View File

@ -9,7 +9,7 @@ import javax.ws.rs.Path;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import io.quarkus.mailer.Mail; import io.quarkus.mailer.Mail;
import io.quarkus.mailer.Mailer; import io.quarkus.mailer.MailTemplate;
import io.quarkus.mailer.reactive.ReactiveMailer; import io.quarkus.mailer.reactive.ReactiveMailer;
@ -19,12 +19,17 @@ public class MailRessource {
@Inject @Inject
private ReactiveMailer mail; private ReactiveMailer mail;
@Inject
private MailTemplate hello;
@GET @GET
@Path("async")
public CompletionStage<Response> sendMail(){ public CompletionStage<Response> sendMail(){
return mail.send(Mail.withText("valcze80@gmail.com", "async", "toto")) //return mail.send(Mail.withText("valcze80@gmail.com", "async", "toto"))
.subscribeAsCompletionStage() //.subscribeAsCompletionStage()
.thenApply(x -> Response.accepted().build()); //.thenApply(x -> Response.accepted().build());
return hello.to("valcze80@gmail.com").subject("test").data("name", "Robert").send().subscribeAsCompletionStage().thenApply(x -> Response.accepted().build());
} }

View File

@ -0,0 +1 @@
Coucou {name} !