List of usage examples for javax.mail.internet AddressException getLocalizedMessage
public String getLocalizedMessage()
From source file:yoyo.framework.enterprise.infra.messaging.MailServiceImpl.java
/** * ??//from w w w . jav a 2 s. c o m * @param from FROM * @param to TO * @param subject ?? * @return * @throws EnterpriseException ?? */ private Message createMessage(final String from, final String to, final String subject) throws EnterpriseException { Validate.notNull(session, "????????"); try { final Message message = new MimeMessage(session); message.setFrom(new InternetAddress(from)); message.addRecipient(Message.RecipientType.TO, new InternetAddress(to)); message.setSubject(subject); return message; } catch (final AddressException e) { throw new EnterpriseException(e.getLocalizedMessage()); } catch (final MessagingException e) { throw new EnterpriseException(e.getLocalizedMessage()); } }