@Test void serviceShouldThrowOnInvalidMailAddress() throws Exception { FakeMail fakeMail = FakeMail.builder() .name("mail") .recipients(mailAddress1) .mimeMessage(MimeMessageBuilder.mimeMessageBuilder() .addToRecipient("invalid")) .build(); assertThatThrownBy(() -> testee.service(fakeMail)).isInstanceOf(RuntimeException.class); }
@Override public void service(Mail mail) throws MessagingException { MimeMessage message = mail.getMessage(); mail.setRecipients(headersAddresses(message)); if (isDebug) { LOGGER.debug("All recipients = {}", mail.getRecipients()); LOGGER.debug("Reprocessing mail using recipients in message headers"); } getMailetContext().sendMail(mail.duplicate()); mail.setState(Mail.GHOST); }
UseHeaderRecipients extends GenericMailet { @Override public void service(Mail mail) throws MessagingException { MimeMessage message = mail.getMessage(); mail.setRecipients(headersAddresses(message)); if (isDebug) { LOGGER.debug("All recipients = {}", mail.getRecipients()); LOGGER.debug("Reprocessing mail using recipients in message headers"); } getMailetContext().sendMail(mail.duplicate()); mail.setState(Mail.GHOST); } }
UseHeaderRecipients extends GenericMailet { @Override public void service(Mail mail) throws MessagingException { MimeMessage message = mail.getMessage(); mail.setRecipients(headersAddresses(message)); if (isDebug) { LOGGER.debug("All recipients = {}", mail.getRecipients()); LOGGER.debug("Reprocessing mail using recipients in message headers"); } getMailetContext().sendMail(mail.duplicate()); mail.setState(Mail.GHOST); }  }
UseHeaderRecipients extends GenericMailet { @Override public void service(Mail mail) throws MessagingException { MimeMessage message = mail.getMessage(); mail.setRecipients(headersAddresses(message)); if (isDebug) { LOGGER.debug("All recipients = {}", mail.getRecipients()); LOGGER.debug("Reprocessing mail using recipients in message headers"); } getMailetContext().sendMail(mail.duplicate()); mail.setState(Mail.GHOST); }  @Override void init(); @Override void service(Mail mail); Collection<MailAddress> headersAddresses(MimeMessage mimeMessage); @Override String getMailetInfo(); }
UseHeaderRecipients extends GenericMailet { @Override public void service(Mail mail) throws MessagingException { MimeMessage message = mail.getMessage(); mail.setRecipients(headersAddresses(message)); if (isDebug) { LOGGER.debug("All recipients = {}", mail.getRecipients()); LOGGER.debug("Reprocessing mail using recipients in message headers"); } getMailetContext().sendMail(mail.duplicate()); mail.setState(Mail.GHOST); }  @Override void init(); @Override void service(Mail mail); Collection<MailAddress> headersAddresses(MimeMessage mimeMessage); @Override String getMailetInfo();  }