[ 
https://issues.apache.org/jira/browse/JAMES-322?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17044300#comment-17044300
 ] 

Rashid Mahmood commented on JAMES-322:
--------------------------------------

{code:java}
public void dispatch(Mail mail) throws MessagingException {
        List<MailAddress> errors =  customizeHeadersAndDeliver(mail);
        if (!errors.isEmpty()) {
                removeFailedRecepients(mail, errors);
                
                // If there were errors, we redirect the email to the ERROR
                // processor.
                // In order for this server to meet the requirements of the SMTP
                // specification, mails on the ERROR processor must be returned 
to
                // the sender. Note that this email doesn't include any details
                // regarding the details of the failure(s).
                // In the future we may wish to address this.
                Mail newMail = MailImpl.builder()
                        .sender(mail.getMaybeSender())
                        .recipients(errors)
                        .mimeMessage(mail.getMessage())
                        .state(Mail.ERROR)
                        .build();
                mailetContext.sendMail(newMail);
        }
        if (consume) {
                // Consume this message
                mail.setState(Mail.GHOST);
        }
}
private void removeFailedRecepients(Mail originalMail, List<MailAddress> 
failedRecepients) {
        for (MailAddress failedRecepient : failedRecepients) {
                originalMail.getRecipients().remove(failedRecepient);
        }
}

{code}

Have added removeFailedRecepients() method in local copy of MailDispatcher, 
will test with some recepients Failed.

> please support  Delivery Status Notifcations as per rfc3461
> -----------------------------------------------------------
>
>                 Key: JAMES-322
>                 URL: https://issues.apache.org/jira/browse/JAMES-322
>             Project: James Server
>          Issue Type: New Feature
>          Components: SMTPServer
>    Affects Versions: 2.2.0, 2.3.0
>         Environment: any
>            Reporter: Ralf Hauser
>            Assignee: Stefano Bagnara
>            Priority: Major
>             Fix For: Trunk
>
>
> http://www.ietf.org/rfc/rfc3461.txt



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to