james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hontvari Jozsef" <hontva...@solware.com>
Subject mail list loop, reverse path <-> Return-Path header
Date Wed, 31 Mar 2004 10:09:04 GMT
(I am not sure what is the status of the merge, so I don't send a patch now,
and anyway, you may not agree on my evaluation)

org.apache.james.James class has a bounce method, which is intended to be
used for bouncing invalid emails to the reverse path (i.e. the email address
supplied in the SMTP MAIL FROM command). RemoteDelivery mailet does use this
method.

This method tries to determine the reverse path from the Return-Path header
(which is stored _within_ the email) instead of using the reverse path
stored along the email in the Mail class. According to the mail RFCs, the
Return-Path header is not indeded to be used by an smtp service, it should
only be used when final delivery occurs, e.g. when storing the mail in a
mailstore used by a pop service. I consider this as a hack, and really don't
like it in James, but because the James smtp handler always inserts the
Return-Path header it seems to be working.

However, the GenericListserv mailet removes the Return-Path header. I think
that is quote correct, on the other hand it breaks the above, not so correct
assumption about the Reverse-Path header. The bounce method in these cases
defaults to the Reply-To, i.e the mail list itself, so you get a mail loop
involving as many people as you have on the list... It happened to me
several times.

In my oppininon the correct solution would be to enirely remove the
dependency on the Return-Path header, but I don't have enough time and
understanding of James. So I only implemented a fallback specifically for
the case when the Return-Path header is not present, which eliminates this
type of loop in my case:

I replaced the
            getLogger().warn("Mail to be bounced does not contain a
Return-Path header.");

line with this code:

            MailAddress reversePath = mail.getSender();
            if (reversePath == null) {
                getLogger().warn("Mail to be bounced does not contain a
Return-Path header and reverse path is null too, sending to postmaster.");
                reply.setRecipient(MimeMessage.RecipientType.TO,
getPostmaster().toInternetAddress());
            } else {
                getLogger().warn("Mail to be bounced does not contain a " +
                        "Return-Path header although expected (wrongly!), "
+
                        "reverse path used (it should be used always): " +
                        reversePath.toString());
                reply.setRecipient(MimeMessage.RecipientType.TO,
reversePath.toInternetAddress());
            }


(I copied this code directly from my source, maybe the log message isn't
suitable for a release)


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message