I'm implementing a web site which also supports interaction via e-mail. Users can send e-mails to the site and we forward them to other users. You could think of it as a listserv, though the functionality is actually more complex.
I'm having a problem with duplicate delivery of reply messages. Suppose user_1 posts something via our web UI; we wind up distributing an e-mail with these headers:
from: user_1@some_domain.com to: list_name@my_web_site.com
We send this message to each e-mail address in the list. If user_2 replies, via their mail client, with Reply All, the reply is liable to look like this:
from: user_2@another_domain.com to: user_1@some_domain.com cc: list_name@my_web_site.com
which is good. However, the effect is that user_2's mail client sends the message directly to user_1, and also sends it to my server. My server then passes it along to all of the list members, including user_1. User_1 receives the message twice; this is the problem.
Is there a way -- say, some trickery with the message headers -- to avoid this double delivery? How do traditional list services avoid it? Note that any scheme which depends on message contents being identical won't work, as my server modifies the message content before passing it along (this is a critical part of the functionality I'm providing).
If I see that user_1@some_domain.com is already on the recipient list for the e-mail, I could avoid forwarding the message to that address. However, this isn't a universal solution, because user_1 might have signed up for my service via some other e-mail address which (unknown to me) ultimately reaches the same mailbox as user_1@some_domain.com.