protected boolean shouldIgnoreBCCAddress(String address) { MilterServerService milterService = Config.getConfig().getMilterServerService(); List<String> ignoreAddresses = milterService.getIgnoreBCCAddress(); Matcher m = headerPattern2.matcher(address.toLowerCase(Locale.ENGLISH).trim()); if (m.matches()) { String mailAddress = m.group(1); for (String ignoreAddress : ignoreAddresses) { if (ignoreAddress.equalsIgnoreCase(mailAddress)) return true; } } else { m = headerPattern3.matcher(address.toLowerCase(Locale.ENGLISH).trim()); if (m.matches()) { String mailAddress = m.group(1); for (String ignoreAddress : ignoreAddresses) { if (ignoreAddress.equalsIgnoreCase(mailAddress)) return true; } } } return false; }
public JilterStatus eoh() { logger.debug("jilter eoh()"); // includeBCC is false if RCPT TO does not contain at least one field in TO, FROM and CC // this is a safety check as sometimes, RCPT TO is something differently entirely // and does not contain the actual recipients in the email MilterServerService milterService = Config.getConfig().getMilterServerService(); if (milterService.getIncludeBCC() && includeBCC) { logger.debug("including BCC addresses"); // check to see if address is flagged to ignore if (rcpts.size() > 0) { Iterator<String> i = rcpts.iterator(); while (i.hasNext()) { String rcpt = i.next(); if (shouldIgnoreBCCAddress(rcpt)) { logger.debug("ignore include bcc address {address='" + rcpt + "'}"); i.remove(); } } } if (rcpts.size() > 0) { try { for (int j = 0; j < rcpts.size(); j++) { if (j == 0) { bos.write("bcc: ".getBytes()); } else { bos.write(",".getBytes()); } bos.write(rcpts.get(j).getBytes()); } bos.write("\n".getBytes()); } catch (IOException io) { logger.error("jilter failed to write end of header data", io); } } } return JilterStatus.SMFIS_CONTINUE; }