@Test public void processShouldNotSendMailWhenNoErrorRecipients() throws Exception { when(virtualTableStore.getResolvedMappings(any(String.class), any(Domain.class))).thenReturn(null); mail = FakeMail.builder() .name("mail") .mimeMessage(message) .recipients(MailAddressFixture.ANY_AT_JAMES, nonDomainWithDefaultLocal) .build(); processor.processMail(mail); assertThat(mailetContext.getSentMails()).isEmpty(); }
public void processMail(Mail mail) throws MessagingException { RrtExecutionResult executionResults = executeRrtFor(mail); if (!executionResults.recipientWithError.isEmpty()) { MailImpl newMail = MailImpl.builder() .name(mail.getName()) .sender(mail.getMaybeSender()) .addRecipients(executionResults.recipientWithError) .mimeMessage(mail.getMessage()) .state(errorProcessor) .build(); mailetContext.sendMail(newMail); } if (executionResults.newRecipients.isEmpty()) { mail.setState(Mail.GHOST); } mail.setRecipients(executionResults.newRecipients); }
RecipientRewriteTableProcessor { public void processMail(Mail mail) throws MessagingException { RrtExecutionResult executionResults = executeRrtFor(mail); if (!executionResults.recipientWithError.isEmpty()) { MailImpl newMail = MailImpl.builder() .name(mail.getName()) .sender(mail.getMaybeSender()) .addRecipients(executionResults.recipientWithError) .mimeMessage(mail.getMessage()) .state(errorProcessor) .build(); mailetContext.sendMail(newMail); } if (executionResults.newRecipients.isEmpty()) { mail.setState(Mail.GHOST); } mail.setRecipients(executionResults.newRecipients); } }
RecipientRewriteTableProcessor { public void processMail(Mail mail) throws MessagingException { RrtExecutionResult executionResults = executeRrtFor(mail); if (!executionResults.recipientWithError.isEmpty()) { MailImpl newMail = MailImpl.builder() .name(mail.getName()) .sender(mail.getMaybeSender()) .addRecipients(executionResults.recipientWithError) .mimeMessage(mail.getMessage()) .state(errorProcessor) .build(); mailetContext.sendMail(newMail); } if (executionResults.newRecipients.isEmpty()) { mail.setState(Mail.GHOST); } mail.setRecipients(executionResults.newRecipients); } RecipientRewriteTableProcessor(RecipientRewriteTable virtualTableStore, DomainList domainList, MailetContext mailetContext, String errorProcessor);  RecipientRewriteTableProcessor(RecipientRewriteTable virtualTableStore, DomainList domainList, MailetContext mailetContext); }
RecipientRewriteTableProcessor { public void processMail(Mail mail) throws MessagingException { RrtExecutionResult executionResults = executeRrtFor(mail); if (!executionResults.recipientWithError.isEmpty()) { MailImpl newMail = MailImpl.builder() .name(mail.getName()) .sender(mail.getMaybeSender()) .addRecipients(executionResults.recipientWithError) .mimeMessage(mail.getMessage()) .state(errorProcessor) .build(); mailetContext.sendMail(newMail); } if (executionResults.newRecipients.isEmpty()) { mail.setState(Mail.GHOST); } mail.setRecipients(executionResults.newRecipients); } RecipientRewriteTableProcessor(RecipientRewriteTable virtualTableStore, DomainList domainList, MailetContext mailetContext, String errorProcessor);  RecipientRewriteTableProcessor(RecipientRewriteTable virtualTableStore, DomainList domainList, MailetContext mailetContext); void processMail(Mail mail); }
RecipientRewriteTableProcessor { public void processMail(Mail mail) throws MessagingException { RrtExecutionResult executionResults = executeRrtFor(mail); if (!executionResults.recipientWithError.isEmpty()) { MailImpl newMail = MailImpl.builder() .name(mail.getName()) .sender(mail.getMaybeSender()) .addRecipients(executionResults.recipientWithError) .mimeMessage(mail.getMessage()) .state(errorProcessor) .build(); mailetContext.sendMail(newMail); } if (executionResults.newRecipients.isEmpty()) { mail.setState(Mail.GHOST); } mail.setRecipients(executionResults.newRecipients); } RecipientRewriteTableProcessor(RecipientRewriteTable virtualTableStore, DomainList domainList, MailetContext mailetContext, String errorProcessor);  RecipientRewriteTableProcessor(RecipientRewriteTable virtualTableStore, DomainList domainList, MailetContext mailetContext); void processMail(Mail mail);  }