0

Использую JavaMailSender для активации учетной записи пользователя, с введенными вручную данными от почты в файле application.propperties приложение работает. но когда указываю var'ы которые задал в настройках приложения на heroku, приложение видит var'ы от БД, но не от почты. В переменные класса(который помечен сервисом) передаю через @Value(${spring.mail.username}).

вот лог

2018-11-19T12:05:21.218481+00:00 app[web.1]: 2018-11-19 12:05:21.218  INFO 4 --- [io-25694-exec-4] o.h.h.i.QueryTranslatorFactoryInitiator  : HHH000397: Using ASTQueryTranslatorFactory
2018-11-19T12:05:21.535318+00:00 app[web.1]: DEBUG: JavaMail version 1.6.2
2018-11-19T12:05:21.536468+00:00 app[web.1]: DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map
2018-11-19T12:05:21.576359+00:00 app[web.1]: DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Oracle]
2018-11-19T12:05:21.588074+00:00 app[web.1]: DEBUG SMTP: useEhlo true, useAuth false
2018-11-19T12:05:21.588139+00:00 app[web.1]: DEBUG SMTP: trying to connect to host "smtp.yandex.ru", port 465, isSSL true
2018-11-19T12:05:22.104969+00:00 app[web.1]: 220 smtp1j.mail.yandex.net ESMTP (Want to use Yandex.Mail for your domain? Visit http://pdd.yandex.ru)
2018-11-19T12:05:22.105128+00:00 app[web.1]: DEBUG SMTP: connected to host "smtp.yandex.ru", port: 465
2018-11-19T12:05:22.106622+00:00 app[web.1]: EHLO 5441aef2-5dc9-4a5a-ab15- 35fd27b847af.prvt.dyno.rt.heroku.com
2018-11-19T12:05:22.164363+00:00 app[web.1]: 250-smtp1j.mail.yandex.net
2018-11-19T12:05:22.164417+00:00 app[web.1]: 250-8BITMIME
2018-11-19T12:05:22.164476+00:00 app[web.1]: 250-PIPELINING
2018-11-19T12:05:22.164555+00:00 app[web.1]: 250-SIZE 42991616
2018-11-19T12:05:22.164726+00:00 app[web.1]: 250-AUTH LOGIN PLAIN XOAUTH2
2018-11-19T12:05:22.164777+00:00 app[web.1]: 250-DSN
2018-11-19T12:05:22.164842+00:00 app[web.1]: 250 ENHANCEDSTATUSCODES
2018-11-19T12:05:22.165398+00:00 app[web.1]: DEBUG SMTP: Found extension "8BITMIME", arg ""
2018-11-19T12:05:22.165535+00:00 app[web.1]: DEBUG SMTP: Found extension "PIPELINING", arg ""
2018-11-19T12:05:22.165629+00:00 app[web.1]: DEBUG SMTP: Found extension "SIZE", arg "42991616"
2018-11-19T12:05:22.165685+00:00 app[web.1]: DEBUG SMTP: Found extension "AUTH", arg "LOGIN PLAIN XOAUTH2"
2018-11-19T12:05:22.165792+00:00 app[web.1]: DEBUG SMTP: Found extension "DSN", arg ""
2018-11-19T12:05:22.165873+00:00 app[web.1]: DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
2018-11-19T12:05:22.166016+00:00 app[web.1]: DEBUG SMTP: protocolConnect login, host=smtp.yandex.ru, user=MAIL_USERNAME, password=<non-null>
2018-11-19T12:05:22.166134+00:00 app[web.1]: DEBUG SMTP: Attempt to authenticate using mechanisms: LOGIN PLAIN DIGEST-MD5 NTLM XOAUTH2 
2018-11-19T12:05:22.166298+00:00 app[web.1]: DEBUG SMTP: Using mechanism LOGIN
2018-11-19T12:05:22.166495+00:00 app[web.1]: DEBUG SMTP: AUTH LOGIN command trace suppressed
2018-11-19T12:05:22.341807+00:00 app[web.1]: DEBUG SMTP: AUTH LOGIN failed
2018-11-19T12:05:22.360422+00:00 app[web.1]: 2018-11-19 12:05:22.359 ERROR 4 --- [io-25694-exec-4] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.mail.MailAuthenticationException: Authentication failed; nested exception is javax.mail.AuthenticationFailedException: 535 5.7.8 Error: authentication failed: Invalid user or password!
2018-11-19T12:05:22.360432+00:00 app[web.1]: ] with root cause
2018-11-19T12:05:22.360434+00:00 app[web.1]: 
2018-11-19T12:05:22.360436+00:00 app[web.1]: javax.mail.AuthenticationFailedException: 535 5.7.8 Error: authentication failed: Invalid user or password!
2018-11-19T12:05:22.360437+00:00 app[web.1]: 
2018-11-19T12:05:22.360439+00:00 app[web.1]:    at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:965) ~[javax.mail-1.6.2.jar!/:1.6.2]
2018-11-19T12:05:22.360441+00:00 app[web.1]:    at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:876) ~[javax.mail-1.6.2.jar!/:1.6.2]
2018-11-19T12:05:22.360442+00:00 app[web.1]:    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:780) ~[javax.mail-1.6.2.jar!/:1.6.2]
2018-11-19T12:05:22.360444+00:00 app[web.1]:    at javax.mail.Service.connect(Service.java:366) ~[javax.mail-1.6.2.jar!/:1.6.2]
2018-11-19T12:05:22.360445+00:00 app[web.1]:    at org.springframework.mail.javamail.JavaMailSenderImpl.connectTransport(JavaMailSenderImpl.java:515) ~[spring-context-support-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
2018-11-19T12:05:22.360447+00:00 app[web.1]:    at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:435) ~[spring-context-support-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
2018-11-19T12:05:22.360449+00:00 app[web.1]:    at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:321) ~[spring-context-support-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
2018-11-19T12:05:22.360450+00:00 app[web.1]:    at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:310) ~[spring-context-support-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
2018-11-19T12:05:22.360451+00:00 app[web.1]:    at СЃom.matzakov.sweater.service.MailSender.send(MailSender.java:26) ~[classes!/:1.0-SNAPSHOT]
2018-11-19T12:05:22.360452+00:00 app[web.1]:    at СЃom.matzakov.sweater.service.UserService.addUser(UserService.java:51) ~[classes!/:1.0-SNAPSHOT]
2018-11-19T12:05:22.360453+00:00 app[web.1]:    at СЃom.matzakov.sweater.controller.RegistrationController.addUser(RegistrationController.java:28) ~[classes!/:1.0-SNAPSHOT]
2018-11-19T12:05:22.360454+00:00 app[web.1]:    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_181-heroku]
2018-11-19T12:05:22.360455+00:00 app[web.1]:    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_181-heroku]
2018-11-19T12:05:22.360456+00:00 app[web.1]:    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_181-heroku]
2018-11-19T12:05:22.360458+00:00 app[web.1]:    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_181-heroku]
2018-11-19T12:05:22.360459+00:00 app[web.1]:    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209) ~[spring-web-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
2018-11-19T12:05:22.360460+00:00 app[web.1]:    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136) ~[spring-web-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
2018-11-19T12:05:22.360461+00:00 app[web.1]:    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) ~[spring-webmvc-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
2018-11-19T12:05:22.360463+00:00 app[web.1]:    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:891) ~[spring-webmvc-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
2018-11-19T12:05:22.360464+00:00 app[web.1]:    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797) ~[spring-webmvc-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
2018-11-19T12:05:22.360466+00:00 app[web.1]:    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
2018-11-19T12:05:22.360467+00:00 app[web.1]:    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991) ~[spring-webmvc-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
2018-11-19T12:05:22.360468+00:00 app[web.1]:    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925) ~[spring-webmvc-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
2018-11-19T12:05:22.360469+00:00 app[web.1]:    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974) ~[spring-webmvc-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
2018-11-19T12:05:22.360470+00:00 app[web.1]:    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:877) ~[spring-webmvc-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
2018-11-19T12:05:22.360471+00:00 app[web.1]:    at javax.servlet.http.HttpServlet.service(HttpServlet.java:661) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
2018-11-19T12:05:22.360476+00:00 app[web.1]:    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851) ~[spring-webmvc-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
2018-11-19T12:05:22.360477+00:00 app[web.1]:    at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
2018-11-19T12:05:22.360479+00:00 app[web.1]:    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
2018-11-19T12:05:22.360480+00:00 app[web.1]:    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
2018-11-19T12:05:22.360481+00:00 app[web.1]:    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) ~[tomcat-embed-websocket-8.5.34.jar!/:8.5.34]
2018-11-19T12:05:22.360482+00:00 app[web.1]:    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
2018-11-19T12:05:22.360483+00:00 app[web.1]:    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
2018-11-19T12:05:22.360484+00:00 app[web.1]:    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320) ~[spring-security-web-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
2018-11-19T12:05:22.360485+00:00 app[web.1]:    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127) ~[spring-security-web-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
2018-11-19T12:05:22.360486+00:00 app[web.1]:    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91) ~[spring-security-web-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
2018-11-19T12:05:22.360487+00:00 app[web.1]:    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
2018-11-19T12:05:22.360488+00:00 app[web.1]:    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119) ~[spring-security-web-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
2018-11-19T12:05:22.360490+00:00 app[web.1]:    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
2018-11-19T12:05:22.360507+00:00 app[web.1]:    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137) ~[spring-security-web-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
2018-11-19T12:05:22.360510+00:00 app[web.1]:    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
2018-11-19T12:05:22.360511+00:00 app[web.1]:    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111) ~[spring-security-web-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
2018-11-19T12:05:22.360512+00:00 app[web.1]:    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
2018-11-19T12:05:22.360514+00:00 app[web.1]:    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170) ~[spring-security-web-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
2018-11-19T12:05:22.360515+00:00 app[web.1]:    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
2018-11-19T12:05:22.360517+00:00 app[web.1]:    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
2018-11-19T12:05:22.360518+00:00 app[web.1]:    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
2018-11-19T12:05:22.360520+00:00 app[web.1]:    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200) ~[spring-security-web-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
2018-11-19T12:05:22.360521+00:00 app[web.1]:    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
2018-11-19T12:05:22.360522+00:00 app[web.1]:    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116) ~[spring-security-web-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
2018-11-19T12:05:22.360524+00:00 app[web.1]:    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
2018-11-19T12:05:22.360530+00:00 app[web.1]:    at org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:124) ~[spring-security-web-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
2018-11-19T12:05:22.360531+00:00 app[web.1]:    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
2018-11-19T12:05:22.360532+00:00 app[web.1]:    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
2018-11-19T12:05:22.360533+00:00 app[web.1]:    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:66) ~[spring-security-web-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
2018-11-19T12:05:22.360534+00:00 app[web.1]:    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
2018-11-19T12:05:22.360536+00:00 app[web.1]:    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
2018-11-19T12:05:22.360537+00:00 app[web.1]:    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) ~[spring-security-web-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
2018-11-19T12:05:22.360538+00:00 app[web.1]:    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
2018-11-19T12:05:22.360539+00:00 app[web.1]:    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56) ~[spring-security-web-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
2018-11-19T12:05:22.360540+00:00 app[web.1]:    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
2018-11-19T12:05:22.360541+00:00 app[web.1]:    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
2018-11-19T12:05:22.360542+00:00 app[web.1]:    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215) ~[spring-security-web-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
2018-11-19T12:05:22.360543+00:00 app[web.1]:    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178) ~[spring-security-web-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
2018-11-19T12:05:22.360544+00:00 app[web.1]:    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357) ~[spring-web-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
2018-11-19T12:05:22.360545+00:00 app[web.1]:    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270) ~[spring-web-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
2018-11-19T12:05:22.360547+00:00 app[web.1]:    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
2018-11-19T12:05:22.360548+00:00 app[web.1]:    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
2018-11-19T12:05:22.360549+00:00 app[web.1]:    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
2018-11-19T12:05:22.360550+00:00 app[web.1]:    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
2018-11-19T12:05:22.360551+00:00 app[web.1]:    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
2018-11-19T12:05:22.360552+00:00 app[web.1]:    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
2018-11-19T12:05:22.360553+00:00 app[web.1]:    at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109) ~[spring-web-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
2018-11-19T12:05:22.360554+00:00 app[web.1]:    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
2018-11-19T12:05:22.360555+00:00 app[web.1]:    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
2018-11-19T12:05:22.360556+00:00 app[web.1]:    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
2018-11-19T12:05:22.360557+00:00 app[web.1]:    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) ~[spring-web-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
2018-11-19T12:05:22.360560+00:00 app[web.1]:    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
2018-11-19T12:05:22.360561+00:00 app[web.1]:    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
2018-11-19T12:05:22.360563+00:00 app[web.1]:    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
2018-11-19T12:05:22.360564+00:00 app[web.1]:    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) ~[spring-web-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
2018-11-19T12:05:22.360565+00:00 app[web.1]:    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
2018-11-19T12:05:22.360566+00:00 app[web.1]:    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
2018-11-19T12:05:22.360567+00:00 app[web.1]:    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
2018-11-19T12:05:22.360568+00:00 app[web.1]:    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
2018-11-19T12:05:22.360569+00:00 app[web.1]:    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-8.5.34.jar!/:8.5.34]
2018-11-19T12:05:22.360570+00:00 app[web.1]:    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493) [tomcat-embed-core-8.5.34.jar!/:8.5.34]
2018-11-19T12:05:22.360571+00:00 app[web.1]:    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.34.jar!/:8.5.34]
2018-11-19T12:05:22.360572+00:00 app[web.1]:    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) [tomcat-embed-core-8.5.34.jar!/:8.5.34]
2018-11-19T12:05:22.360573+00:00 app[web.1]:    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.34.jar!/:8.5.34]
2018-11-19T12:05:22.360574+00:00 app[web.1]:    at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:685) [tomcat-embed-core-8.5.34.jar!/:8.5.34]
2018-11-19T12:05:22.360575+00:00 app[web.1]:    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [tomcat-embed-core-8.5.34.jar!/:8.5.34]
2018-11-19T12:05:22.360576+00:00 app[web.1]:    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800) [tomcat-embed-core-8.5.34.jar!/:8.5.34]
2018-11-19T12:05:22.360577+00:00 app[web.1]:    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.34.jar!/:8.5.34]
2018-11-19T12:05:22.360578+00:00 app[web.1]:    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806) [tomcat-embed-core-8.5.34.jar!/:8.5.34]
2018-11-19T12:05:22.360579+00:00 app[web.1]:    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498) [tomcat-embed-core-8.5.34.jar!/:8.5.34]
2018-11-19T12:05:22.360580+00:00 app[web.1]:    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.34.jar!/:8.5.34]
2018-11-19T12:05:22.360581+00:00 app[web.1]:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_181-heroku]
2018-11-19T12:05:22.360582+00:00 app[web.1]:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_181-heroku]
2018-11-19T12:05:22.360583+00:00 app[web.1]:    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.34.jar!/:8.5.34]
2018-11-19T12:05:22.360585+00:00 app[web.1]:    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_181-heroku]
2018-11-19T12:05:22.360586+00:00 app[web.1]: 
2018-11-19T12:05:22.397045+00:00 heroku[router]: at=info method=POST path="/registration" host=projectlearn.herokuapp.com request_id=1d72a355-a519-4f48-8227-6b907a2b0b3b fwd="77.94.204.142" dyno=web.1 connect=0ms service=1249ms status=500 bytes=859 protocol=https

1 ответ 1

0

Делал это без application.propperties, на хероку работало:

@Service
public class MailSender {

@Autowired
private JavaMailSender mailSender;

public void send(String emailTo, String subject, String message) {
    SimpleMailMessage mailMessage = new SimpleMailMessage();

    mailMessage.setFrom("sandbox0cc527a6afc64f86a2722c1a32b31f8b.mailgun.org");
    mailMessage.setTo(emailTo);
    mailMessage.setSubject(subject);
    mailMessage.setText(message);

    mailSender.send(mailMessage);
}
}

@Service
public class UserService{

@Autowired
private MailSender mailSender;
...
mailSender.send(user.getLogin(), "Activation code", message);
}

@Configuration
public class MailConfig {

@Bean
public JavaMailSender getMailSender() {
    JavaMailSenderImpl mailSender = new JavaMailSenderImpl();

    mailSender.setHost("smtp.gmail.com");
    mailSender.setUsername("********@gmail.com");
    mailSender.setPassword("********");
    mailSender.setPort(465);

    Properties properties = mailSender.getJavaMailProperties();
    properties.setProperty("mail.transport.protocol", "smtps");

    return mailSender;
}
}
2
  • У меня такой конфиг как минимум на локалхосте не работает. Почему порт 465, а не 587 как обычно в примерах? Или это раньше 465-й порт указывался, а теперь нужно 587-й?
    – pazukdev
    9 мая 2020 в 10:11
  • Все, понятно. 465 для ssl, 587 для tls. Прошу прощения.
    – pazukdev
    9 мая 2020 в 10:19

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.