NutzCN Logo
精华 用 nutz 发送邮件报错求大神解答
发布于 2944天前 作者 qq_95b3862e 2531 次浏览 复制 上一个帖子 下一个帖子
标签:

java.lang.IllegalStateException: The MimeMessage is already built.
at org.apache.commons.mail.Email.buildMimeMessage(Email.java:1273)
at org.apache.commons.mail.MultiPartEmail.buildMimeMessage(MultiPartEmail.java:254)
at org.apache.commons.mail.HtmlEmail.buildMimeMessage(HtmlEmail.java:516)
at org.apache.commons.mail.ImageHtmlEmail.buildMimeMessage(ImageHtmlEmail.java:108)
at org.apache.commons.mail.Email.send(Email.java:1447)
at com.zdl.biz.service.BaseService.forgetCheck(BaseService.java:152)
at com.zdl.biz.module.CommonModule.forgetCheck(CommonModule.java:108)
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:498)
at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:25)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:33)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:198)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:958)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:452)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1087)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)

4 回复

email.js贴一下

var ioc = {
emailAuthenticator : {
type : "org.apache.commons.mail.DefaultAuthenticator",
args : [ {
java : "$conf.get('mail.UserName')"
}, {
java : "$conf.get('mail.Password')"
} ]
},
htmlEmail : {
type : "org.apache.commons.mail.ImageHtmlEmail",
singleton : false,
fields : {
hostName : {
java : "$conf.get('mail.HostName')"
},
smtpPort : {
java : "$conf.get('mail.SmtpPort')"
},
authenticator : {
refer : "emailAuthenticator"
},
SSLOnConnect : {
java : "$conf.get('mail.SSLOnConnect')"
},
from : {
java : "$conf.get('mail.From')"
}
}
}
};

//发送邮件
             String theMessage ="My honoured "+name+
                          ":\r     your password have been changed to "+newPassword+" !";
             htmlEmail.setSubject("找回密码--找到啦");
             htmlEmail.setMsg(theMessage);
             htmlEmail.addTo(email);
             htmlEmail.send();



          打开服务器后第一次发送没问题,第二次就报这个已经build的错
添加回复
请先登陆
回到顶部