Setting up mail in a JHipster project (Spring)

I know this is probably a very simple question, but I have been stuck with this for many hours. I did not find a problem after many studies on the Internet.

I started the jhipster project and now I'm trying to set up a mail server that will be used to send registration emails to my new users. Therefore, I edited two configuration files that exist in the project:

../SRC/test/resources/configuration/application.yml

../SRC/basic/resources/configurations/application.yml

In each of them I added the following lines in the section "Spring: mail:"

    host: smtp.gmail.com
    port: 25
    user: xxx@gmail.com
    password: xxx
    protocol: smtp
    tls: true
    auth: true
    from: xxx@gmail.com

, , "sendEmail" "mailService", . - ? ? - ?

:

, , sendMail:

[DEBUG] org.portotech.perdigao.config.AsyncConfiguration - Creating Async Task Executor<br>
[DEBUG] org.portotech.perdigao.config.MetricsConfiguration - Registering JVM gauges<br>
[DEBUG] org.portotech.perdigao.config.CacheConfiguration - No cache<br>
[WARN] org.portotech.perdigao.Application - No Spring profile configured, running with default configuration<br>
[DEBUG] org.portotech.perdigao.config.MailConfiguration - Configuring mail server<br>
[INFO] org.portotech.perdigao.config.ThymeleafConfiguration - loading non-reloadable mail messages resources<br>
[DEBUG] org.portotech.perdigao.config.DatabaseConfiguration - Configuring Mongeez<br>
[DEBUG] org.portotech.perdigao.service.MailService - Send e-mail[multipart 'false' and html 'false'] to 'xxx@gmail.com' with subject 'test' and content=test<br>
[INFO] org.portotech.perdigao.config.CacheConfiguration - Remove Cache Manager metrics<br>
[INFO] org.portotech.perdigao.config.CacheConfiguration - Closing Cache Manager<br>
Disconnected from the target VM, address: '127.0.0.1:51831', transport: 'socket'<br>
Process finished with exit code 0

, , . , IDE (Intellij), , , :

[DEBUG] org.portotech.perdigao.config.AsyncConfiguration - Creating Async Task Executor<br>
[DEBUG] org.portotech.perdigao.config.MetricsConfiguration - Registering JVM gauges<br>
[DEBUG] org.portotech.perdigao.config.CacheConfiguration - No cache<br>
[WARN] org.portotech.perdigao.Application - No Spring profile configured, running with default configuration<br>
[DEBUG] org.portotech.perdigao.config.MailConfiguration - Configuring mail server<br>
[INFO] org.portotech.perdigao.config.ThymeleafConfiguration - loading non-reloadable mail messages resources<br>
[DEBUG] org.portotech.perdigao.config.DatabaseConfiguration - Configuring Mongeez<br>
[DEBUG] org.portotech.perdigao.service.MailService - Send e-mail[multipart 'false' and html 'false'] to 'xxx@gmail.com' with subject 'test' and content=test<br>
[WARN] org.portotech.perdigao.service.MailService - E-mail could not be sent to user 'xxx@gmail.com', exception is: Mail server connection failed; nested exception is javax.mail.MessagingException: Connection error (java.net.NoRouteToHostException: No route to host). Failed messages: javax.mail.MessagingException: Connection error (java.net.NoRouteToHostException: No route to host)<br>
[INFO] org.portotech.perdigao.config.CacheConfiguration - Remove Cache Manager metrics<br>
[INFO] org.portotech.perdigao.config.CacheConfiguration - Closing Cache Manager

, NoRouteToHostException, , . =/. , ping smtp.gmail.com, .

+4
1

25 TLS, TLS 587.

+5

All Articles