NutzCN Logo
问答 新手入门中发送邮件报错。邮件地址怎么配成自己的qq
发布于 3329天前 作者 明天会吹什么风 2764 次浏览 复制 上一个帖子 下一个帖子
标签: email

java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.nutz.lang.inject.InjectBySetter.inject(InjectBySetter.java:26)
at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:32)
at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:56)
at org.nutz.ioc.ObjectProxy.get(ObjectProxy.java:70)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:207)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:212)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:139)
at net.wendal.nutzbook.MainSetup.init(MainSetup.java:43)
at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:256)
at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:115)
at org.nutz.mvc.ActionHandler.(ActionHandler.java:19)
at org.nutz.mvc.NutFilter.init(NutFilter.java:78)
at net.wendal.nutzbook.mvc.NutzBookNutFilter.init(NutzBookNutFilter.java:22)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:115)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4072)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4726)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.apache.commons.mail.EmailException: javax.mail.internet.AddressException: Missing final '@domain' in string 185959236'' at org.apache.commons.mail.Email.createInternetAddress(Email.java:1909) at org.apache.commons.mail.Email.setFrom(Email.java:749) at org.apache.commons.mail.Email.setFrom(Email.java:732) at org.apache.commons.mail.Email.setFrom(Email.java:712) ... 35 more Caused by: javax.mail.internet.AddressException: Missing final '@domain' in string185959236''
at javax.mail.internet.InternetAddress.checkAddress(InternetAddress.java:1243)
at javax.mail.internet.InternetAddress.validate(InternetAddress.java:1134)
at org.apache.commons.mail.Email.createInternetAddress(Email.java:1905)
... 38 more
java.lang.RuntimeException: Fail to set '185959236'[ 185959236 ] by setter org.apache.commons.mail.Email.'setFrom()' because [org.apache.commons.mail.EmailException: javax.mail.internet.AddressException: Missing final '@domain' in string 185959236'']: javax.mail.internet.AddressException: Missing final '@domain' in string185959236''
at org.nutz.lang.Lang.makeThrow(Lang.java:99)
at org.nutz.lang.inject.InjectBySetter.inject(InjectBySetter.java:31)
at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:32)
at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:56)
at org.nutz.ioc.ObjectProxy.get(ObjectProxy.java:70)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:207)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:212)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:139)
at net.wendal.nutzbook.MainSetup.init(MainSetup.java:43)
at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:256)
at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:115)
at org.nutz.mvc.ActionHandler.(ActionHandler.java:19)
at org.nutz.mvc.NutFilter.init(NutFilter.java:78)
at net.wendal.nutzbook.mvc.NutzBookNutFilter.init(NutzBookNutFilter.java:22)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:115)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4072)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4726)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
2015-11-11 15:30:14,470 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:126) INFO - Nutz.Mvc[nutz] is up in 1092ms

mail.properties我的配置如下
mail.HostName=smtp.exmail.qq.com
mail.SmtpPort=465
mail.UserName=749914978
mail.Password=xxxxxxx
mail.SSLOnConnect=true
mail.From=749914978
mail.charset=UTF-8

求大神指导。

7 回复

mail.From写的是完整邮箱地址,而不是单独写个QQ号

来自炫酷的 NutzCN

org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.exmail.qq.com:465
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1410)
at net.wendal.nutzbook.MainSetup.init(MainSetup.java:48)
at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:256)
at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:115)
at org.nutz.mvc.ActionHandler.(ActionHandler.java:19)
at org.nutz.mvc.NutFilter.init(NutFilter.java:78)
at net.wendal.nutzbook.mvc.NutzBookNutFilter.init(NutzBookNutFilter.java:22)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:115)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4072)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4726)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: javax.mail.AuthenticationFailedException: 521 Error: Invalid domain name, please use smtp.qq.com. More information at http://service.mail.qq.com/cgi-bin/help?subtype=1&&id=28&&no=371

at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:892)
at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:814)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:728)
at javax.mail.Service.connect(Service.java:386)
at javax.mail.Service.connect(Service.java:245)
at javax.mail.Service.connect(Service.java:194)
at javax.mail.Transport.send0(Transport.java:253)
at javax.mail.Transport.send(Transport.java:124)
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1400)
... 24 more

2015-11-11 15:53:50,240 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:126) INFO - Nutz.Mvc[nutz] is up in 1865ms
2015-11-11 15:53:50 org.apache.coyote.http11.Http11Protocol start

这个是端口号错误吗?

mail.HostName=smtp.exmail.qq.com
mail.SmtpPort=465
mail.UserName=749914978
mail.Password=xxxxxx
mail.SSLOnConnect=true
mail.From=749914978@qq.com
mail.charset=UTF-8
我这么改了还是报错

@qq_e1e2a1de 问一下 你这个问题是怎么解决的呢

@qq_999005dc 确保换上正确的jar就可以了

添加回复
请先登陆
回到顶部