邮件发送测试失败

邮件配置如下:

image.png

邮件发送报错如下:,有大佬帮忙看下嘛?

com.sun.mail.util.MailConnectException: Couldn't connect to host, port: SMTP.qq.com, 25; timeout -1;
nested exception is:
	java.net.UnknownHostException: SMTP.qq.com
	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2209)
	at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:740)
	at javax.mail.Service.connect(Service.java:366)
	at javax.mail.Service.connect(Service.java:246)
	at com.fr.base.EmailManager.connect(EmailManager.java:614)
	at com.fr.base.EmailManager.send(EmailManager.java:495)
	at com.fr.base.EmailManager.send(EmailManager.java:462)
	at com.fr.base.EmailManager.send(EmailManager.java:355)
	at com.fr.base.EmailManager.send(EmailManager.java:345)
	at com.fr.base.EmailManager.send(EmailManager.java:326)
	at com.fr.base.EmailManager.send(EmailManager.java:294)
	at com.fr.base.EmailManager.sendTestMail(EmailManager.java:258)
	at com.fr.decision.webservice.v10.config.ConfigService.testEmailConnection(Unknown Source)
	at sun.reflect.GeneratedMethodAccessor1479.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.fr.decision.config.ConfigInterceptor.intercept(Unknown Source)
	at com.fr.decision.webservice.v10.config.ConfigService$$EnhancerByCGLIB$$fb9e39a3.testEmailConnection()
	at com.fr.web.controller.decision.api.config.EmailResource.testEmail(Unknown Source)
	at com.fr.web.controller.decision.api.config.EmailResource$$FastClassBySpringCGLIB$$6124e2a1.invoke()
	at com.fr.third.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:201)
	at com.fr.third.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:710)
	at com.fr.third.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
	at com.fr.third.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85)
	at com.fr.decision.webservice.aspect.DecisionLogAspect.doControllerAround(Unknown Source)
	at sun.reflect.GeneratedMethodAccessor1470.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.fr.third.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
	at com.fr.third.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
	at com.fr.third.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:69)
	at com.fr.third.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168)
	at com.fr.third.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
	at com.fr.third.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
	at com.fr.third.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:646)
	at com.fr.web.controller.decision.api.config.EmailResource$$EnhancerBySpringCGLIB$$28f492.testEmail()
	at sun.reflect.GeneratedMethodAccessor1478.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.fr.third.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
	at com.fr.third.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
	at com.fr.third.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
	at com.fr.third.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:747)
	at com.fr.third.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:676)
	at com.fr.third.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
	at com.fr.third.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938)
	at com.fr.third.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
	at com.fr.third.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
	at com.fr.third.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
	at com.fr.third.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at com.fr.decision.base.DecisionServletInitializer$6.doFilterInternal(Unknown Source)
	at com.fr.third.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at com.fr.decision.base.DecisionServletInitializer$4.doFilter(Unknown Source)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at com.fr.plugin.sln3611.SlnRequestFilterProvider.doFilter(Unknown Source)
	at com.fr.decision.base.DecisionServletInitializer$5.doFilter(Unknown Source)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at com.fr.third.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
	at com.fr.third.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:543)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:688)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:609)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:818)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1623)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.UnknownHostException: SMTP.qq.com
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
	at java.net.Socket.connect(Socket.java:589)
	at java.net.Socket.connect(Socket.java:538)
	at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:359)
	at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:238)
	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2175)
	... 88 more

补充问题内容

端口25和465试过,不同加密方式试过。密码用的邮箱客户端授权码。

本地设计器决策系统试了,是可以的,生产上不行

目前的思路可能和生产的网络环境有关系,但是不知道和哪方面的内容有关系

FineReport jongwang 发布于 2020-9-3 11:26 (编辑于 2020-9-3 12:19)
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共3回答
最佳回答
1
zsh331Lv8专家互助
发布于2020-9-3 11:52(编辑于 2020-9-3 14:16)

邮箱-https://help.finereport.com/doc-view-2216.html


163和qq邮箱的密码记得用《授权码》,参考文档配置,注意细节!


========

在服务器上执行脚本,测试对应端口是否正常开启,如果没有,开启即可。

telnet domain 端口号

-- telnet domain 25


image.png

  • jongwang jongwang(提问者) 生产上如果邮箱服务器不是SMTP.开头的,是不是不行?
    2020-09-03 14:13 
  • zsh331 zsh331 回复 jongwang(提问者) 不是,你看我服务器上的,具体还是根据实际邮箱服务来配置!
    2020-09-03 14:17 
  • jongwang jongwang(提问者) 回复 zsh331 嗯嗯,是的,看来不是非要SMTP.开头。那会不会是因为生产上是IMAP的邮箱类型,而我们这边是要求SMTP类型的缘故,请问下你这边的是SMTP类型的邮箱服务器吗
    2020-09-03 14:24 
  • jongwang jongwang(提问者) 回复 zsh331 目前测试邮件通过了,因为tomcat部署在内网,没有打通到smtp或者其他发件邮箱服务器,所以发不出来,打通之后就能测试通过了
    2020-09-03 17:13 
  • zsh331 zsh331 回复 jongwang(提问者) 这都是实战坑。
    2020-09-03 17:14 
最佳回答
1
黄多鸭SamirLv4见习互助
发布于2020-9-3 11:54

QQ 邮箱的密码得使用授权码

  1. 参考QQ邮箱官方文档 https://service.mail.qq.com/cgi-bin/help?subtype=1&&id=14&&no=1000898


可以试试看,需要设置授权码-发送短信之类的步骤

最佳回答
0
snrtuemcLv8专家互助
发布于2020-9-3 11:28

端口加密方式改下

image.png

  • jongwang jongwang(提问者) 试了下,这个,再试了下不加密,端口25和465都试过,暂时还是不行
    2020-09-03 11:37 
  • snrtuemc snrtuemc 回复 jongwang(提问者) 按这个配置,163邮箱可以
    2020-09-03 11:41 
  • 4关注人数
  • 864浏览人数
  • 最后回答于:2020-9-3 14:16
    请选择关闭问题的原因
    确定 取消
    返回顶部