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 header(String headerf, String headerv) { logger.debug("jilter header {name='" + headerf + "',value='" + headerv + "'}"); StringBuffer header = new StringBuffer(); header.append(headerf); header.append(": "); header.append(headerv); header.append("\n"); try { bos.write(header.toString().getBytes()); } catch (IOException io) { logger.error("jilter failed to write header field", io); } Matcher m = headerPattern1.matcher(headerf.toLowerCase(Locale.ENGLISH).trim()); if (m.matches()) { logger.debug("jilter found to/bcc/cc header"); String[] addresses = headerv.split(","); for (int i = 0; i < addresses.length; i++) { includeBCC = includeBCC | rcpts.remove(addresses[i].toLowerCase(Locale.ENGLISH).trim()); logger.debug("jilter del recipient {recipient='" + addresses[i] + "'}"); m = headerPattern2.matcher(addresses[i].toLowerCase(Locale.ENGLISH).trim()); if (m.matches()) { String mailAddress = m.group(1); includeBCC = includeBCC | rcpts.remove(mailAddress); logger.debug("jilter del recipient {recipient='" + mailAddress + "'}"); } else { m = headerPattern3.matcher(addresses[i].toLowerCase(Locale.ENGLISH).trim()); if (m.matches()) { String mailAddress = m.group(1); includeBCC = includeBCC | rcpts.remove(mailAddress); logger.debug("jilter del recipient {recipient='" + mailAddress + "'}"); } } } } return JilterStatus.SMFIS_CONTINUE; }