From 53b658098c4920b1e9e09203b2bc1392f9583e9e Mon Sep 17 00:00:00 2001 From: Bernd Ritter Date: Fri, 12 Apr 2024 10:13:01 +0200 Subject: [PATCH] jakarta mail has to use the same version to work multiple times --- pom.xml | 2 +- src/main/java/de/holarse/queues/commands/MailCommand.java | 5 +++++ .../java/de/holarse/web/controller/RegisterController.java | 4 +++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index b458a886..6389afac 100644 --- a/pom.xml +++ b/pom.xml @@ -321,7 +321,7 @@ jakarta.activation jakarta.activation-api - 2.1.3 + 2.0.1 com.sun.mail diff --git a/src/main/java/de/holarse/queues/commands/MailCommand.java b/src/main/java/de/holarse/queues/commands/MailCommand.java index d8892d39..67911147 100644 --- a/src/main/java/de/holarse/queues/commands/MailCommand.java +++ b/src/main/java/de/holarse/queues/commands/MailCommand.java @@ -42,5 +42,10 @@ public String getBody() { public void setBody(String body) { this.body = body; } + + @Override + public String toString() { + return "MailCommand{" + "sender=" + sender + ", recipients=" + recipients + ", subject=" + subject + '}'; + } } diff --git a/src/main/java/de/holarse/web/controller/RegisterController.java b/src/main/java/de/holarse/web/controller/RegisterController.java index 133ca5e5..432664f7 100644 --- a/src/main/java/de/holarse/web/controller/RegisterController.java +++ b/src/main/java/de/holarse/web/controller/RegisterController.java @@ -136,9 +136,11 @@ public ModelAndView register(@Valid @ModelAttribute("registerForm") final Regist userSlug.setUser(user); userSlugRepository.saveAndFlush(userSlug); - // TODO: Mail an Email-Adresse mit Verification-Key asynchron anleiern.... + log.debug("Preparing mail to send"); final RegisterMailMessage rmm = new RegisterMailMessage(user); + log.debug("Passing mail to queue"); jmsTemplate.convertAndSend(JmsQueueTypes.QUEUE_MAIL, emailRenderService.to(rmm)); + log.debug("Passing complete"); mv.addObject("validationKey", userStatus.getVerificationHash()); mv.addObject(WebDefines.DEFAULT_VIEW_ATTRIBUTE_NAME, "sites/accounts/registered");