Renaud is Not Bill Gates
Renaud is Not Bill Gates

Reputation: 2084

configuring email in jhipster

I'm trying to configure email on a jhipster application, but I get this error :

Exception in thread "restartedMain" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: mapping values are not allowed here
 in 'reader', line 73, column 17:
                port: 587
                    ^

and this is my configuration :

jhipster:
    datasource: # JHipster-specific configuration, in addition to the standard spring.datasource properties
        cachePrepStmts: true
        prepStmtCacheSize: 250
        prepStmtCacheSqlLimit: 2048
        useServerPrepStmts: true
    cache: # Hibernate 2nd level cache, used by CacheConfiguration
        timeToLiveSeconds: 3600
        ehcache:
            maxBytesLocalHeap: 16M
    mail: # specific JHipster mail property, for standard properties see MailProperties
        host: smtp.gmail.com
            port: 587
            user: [email protected]
            password: password
            protocol: smtp
            tls: true
            auth: true
            from: [email protected]

How can I sovle this problem ?

Upvotes: 2

Views: 5246

Answers (1)

Gaël Marziou
Gaël Marziou

Reputation: 16294

Your mail config is wrong it should not be under jhipster and also some mail properties should be less indented, they be must under spring like in the application-prod.yml that JHipster generated in your project.

Please read this tip in our documentation.

spring:
    mail: 
        host: smtp.gmail.com
        port: 587
        user: [email protected]
        password: password
        protocol: smtp
        tls: true
        auth: true
        from: [email protected]
        properties.mail.smtp:
            auth: true
            starttls.enable: true
            ssl.trust: smtp.gmail.com

Upvotes: 4

Related Questions