Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * /
package org.apache.james.protocols.smtp.core.fastfail;
import  org.apache.mailet.MailAddress;

This handler can be used to just ignore duplicated recipients.
public class SupressDuplicateRcptHandler implements RcptHook {


See also:
org.apache.james.protocols.smtp.hook.RcptHook.doRcpt(org.apache.james.protocols.smtp.SMTPSession, org.apache.mailet.MailAddress, org.apache.mailet.MailAddress)
    public HookResult doRcpt(SMTPSession session, MailAddress sender, MailAddress rcpt) {
        Collection rcptList = (Collectionsession.getState().get(.);
        // Check if the recipient is already in the rcpt list
        if(rcptList != null && rcptList.contains(rcpt)) {
            StringBuilder responseBuffer = new StringBuilder();
                          .append(" Recipient <")
                          .append("> OK");
            session.getLogger().debug("Duplicate recipient not add to recipient list: " + rcpt.toString());
            return new HookResult(.,.responseBuffer.toString());
        return new HookResult(.);
New to GrepCode? Check out our FAQ X