日期:2014-05-18  浏览次数:20692 次

求助各位大佬Email发送错误
源代码:

 @Override
        public void onEvent(MailValueObject valueEvent, long sequence, boolean b) throws Exception {
            LOGGER.info("send Email");

            final MimeMessage mimeMessage = javaMailSender.createMimeMessage();
            final MimeMessageHelper messageHelper = new MimeMessageHelper(mimeMessage, DEFAULT_ENCODING);
            try {
                messageHelper.setSubject(valueEvent.getSubject());
                messageHelper.setFrom(valueEvent.getMailFrom());
                messageHelper.setTo(valueEvent.getRecipientEmail());

                messageHelper.setText(valueEvent.getContent(), true /* isHtml */);

                javaMailSender.send(mimeMessage);
            } catch (MessagingException e) {
                LOGGER.error("MessageingException", e.fillInStackTrace());
            }
        }
    }


错误提示
javax.mail.internet.AddressException: Local address contains control or whitespace
at com.orchestrall.domains.external.impl.EmailSenderDisruptorImpl$EmailEventHandler.onEvent(EmailSenderDisruptorImpl.java:98) [EmailSenderDisruptorImpl$EmailEventHandler.class:na]
at com.orchestrall.domains.external.impl.EmailSenderDisruptorImpl$EmailEventHandler.onEvent(EmailSenderDisruptorImpl.java:78) [EmailSenderDisruptorImpl$EmailEventHandler.class:na]
at com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:120) [disruptor-3.0.1.jar:na]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) [na:1.6.0_07]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) [na:1.6.0_07]
at java.lang.Thread.run(Thread.java:619) [na:1.6.0_07]

------解决方案--------------------
 Local address contains control or whitespace、、、
地址有空格。
------解决方案--------------------

貌似地址有错呀,检查下地址呗!~
------解决方案--------------------
AddressException,地址吧,,,,