JHipster Email Configuration with Outlook Fails: Connection Refused to localhost:25

I'm trying to register a new user in my JHipster application (JHipster 8.7.3, Spring Boot 3.3.5). I've configured email with Outlook for sending the activation email. Here are my configurations:

application.yml:

jhipster:
  mail:
    enabled: true
    from: [email protected]

application-dev.yml:

spring:
  mail:
    host: smtp-mail.outlook.com
    port: 587
    username: [email protected]
    password: password
    protocol: smtp
    tls: true
    properties.mail.smtp:
      auth: true
      starttls.enable: true
      ssl.trust: smtp-mail.outlook.com
jhipster:
  mail:
    base-url: http://127.0.0.1:8080

However, I am getting the following error:

DEBUG c.e.statistics.service.MailService       : Sending activation email to '[email protected]'
DEBUG c.e.statistics.service.MailService       : Send email[multipart 'false' and html 'true'] to '[email protected]' with subject 'statistics account activation is required' and content=<!doctype html>_<html lang="fr">_  <head>_    <title>statistics account activation is required</title>_    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />_    <link rel="icon" href="http://127.0.0.1:8080/favicon.ico" />_  </head>_  <body>_    <p>Dear admin</p>_    <p>Your statistics account has been created, please click on the URL below to activate it:</p>_    <p>_      <a href="http://127.0.0.1:8080/account/activate?key=r5jBoQ2PfCKpJI9hrGjK">http://127.0.0.1:8080/account/activate?key=r5jBoQ2PfCKpJI9hrGjK</a>_    </p>_    <p>_      <span>Regards,</span>_      <br />_      <em>statistics Team.</em>_    </p>_  </body>_</html>_
DEBUG org.eclipse.angus.mail.smtp              : useEhlo true, useAuth false
DEBUG org.eclipse.angus.mail.smtp              : trying to connect to host "localhost", port 25, isSSL false
 WARN c.e.statistics.service.MailService       : Email could not be sent to user '[email protected]'

org.springframework.mail.MailSendException: Mail server connection failed. Failed messages: org.eclipse.angus.mail.util.MailConnectException: Couldn't connect to host, port: localhost, 25; timeout -1;
  nested exception is:
        java.net.ConnectException: Connection refused

It seems that another configuration is overriding the one present in the YAML files. Has anyone encountered a similar issue or can provide guidance on how to resolve this?

Thanks in advance!

What I checked:

What I expected:

What actually happened:

Upvotes: 0

Views: 21

Answers (0)

Related Questions