Hide sender but keep reply-to sender address?

Is it possible to replace sender with name of of the mailing list, but keep senders email in reply-to intact? I would like members to receive email with From: Mailing List Name, but if somebody replies to the email then the email would go to the original sender of the message (and not to the list).
Thanks!

Andrei wrote:
This would require a custom handler <http://wiki.list.org/x/l4A9> to rewrite the From: and add/replace/augment a Reply-to:
It can't be done with standard configuration settings.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan

Andrei wrote:
OK, thanks. Does anybody has a custom handler like that and is willing to share? I have no idea how to do this.
Something like this
from email.Utils import formataddr, getaddresses, parseaddr
def process(mlist, msg, msgdata): orig_from = parseaddr(msg.get('from')) orig_rt = msg.get_all('reply-to') del msg['from'] msg['From'] = formataddr((mlist.description, mlist.GetListEmail())) del msg['reply-to'] if orig_rt: rt_list = getaddresses(orig_rt) rt_addr = [x[1] for x in rt_list] if orig_from[1] not in rt_addr: rt_list += [orig_from] else: rt_list = [orig_from] msg['Reply-To'] = ', '.join([formataddr(x) for x in rt_list])
should do it. This will add the From: address to any existing Reply-To: if it isn't already there or create a Reply-To: if there wasn't one. It can go pretty much anywhere in the pipeline before ToDigest, but immediately before is good.
The list's anonymous_list and first_strip_reply_to must be No, and reply_goes_to_list must be Poster.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan

Thanks, Mark. I'm trying to use this just for one of the lists.
I added MyHandler.py in /var/lib/mailman/Mailman/Handlers, and in config_list added mlist.pipeline = [ 'Replybot', 'MyHandler', 'Moderate', 'ToOutgoing', ]
When I run config.list test-list I get
File "/usr/sbin/config_list", line 243, in <module> 'ToOutgoing', NameError: name 'mlist' is not defined
On Mon, Mar 11, 2013 at 12:35 PM, Mark Sapiro <mark@msapiro.net> wrote:

Andrei wrote:
I'm not sure what you mean by "in config_list added", but you should create an input file which contains only
mlist.pipeline = [ 'SpamDetect', 'Approve', 'Replybot', 'Moderate', 'Hold', 'MimeDel', 'Scrubber', 'Emergency', 'Tagger', 'CalcRecips', 'AvoidDuplicates', 'Cleanse', 'CleanseDKIM', 'CookHeaders', 'MyHandler', 'ToDigest', 'ToArchive', 'ToUsenet', 'AfterDelivery', 'Acknowledge', 'ToOutgoing', ]
I.e. it should look like the definition of GLOBAL_PIPELINE in Defaults.py with the addition of MyHandler immediately before ToDigest (and the comments removed).
Then you run
config_list -i path/to/above/file test-list
It looks like you may have modified the config_list program itself in some way rather than specifying the complete pipeline in an input file.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan

Sorry about that and thanks for your patience with this. I made all the changes. No errors are generated on config_list -i /home/files/config-file test-list However, when I send an email it gets delivered with unmodified reply-to header. From is replaced with the list name. When I hit reply, list address comes up, not the original sender address. I don't see anything in mailman error log. Here are the mail headers: http://pastebin.com/5qnms2wK From and Reply-to headers seem unchanged and are from the list (not the sender).
CAT /usr/lib/mailman/Mailman/Handlers/MyHandler.py #!/usr/bin/env python # from email.Utils import formataddr, getaddresses, parseaddr
def process(mlist, msg, msgdata): orig_from = parseaddr(msg.get('from')) orig_rt = msg.get_all('reply-to') del msg['from'] msg['From'] = formataddr((mlist.description, mlist.GetListEmail())) del msg['reply-to'] if orig_rt: rt_list = getaddresses(orig_rt) rt_addr = [x[1] for x in rt_list] if orig_from[1] not in rt_addr: rt_list += [orig_from] else: rt_list = [orig_from] msg['Reply-To'] = ', '.join([formataddr(x) for x in rt_list])
CAT CONFIG-FILE: mlist.pipeline = [ 'SpamDetect', 'Approve', 'Replybot', 'Moderate', 'Hold', 'MimeDel', 'Scrubber', 'Emergency', 'Tagger', 'CalcRecips', 'AvoidDuplicates', 'Cleanse', 'CleanseDKIM', 'CookHeaders', 'MyHandler', 'ToDigest', 'ToArchive', 'ToUsenet', 'AfterDelivery', 'Acknowledge', 'ToOutgoing', ]
On Mon, Mar 11, 2013 at 2:11 PM, Mark Sapiro <mark@msapiro.net> wrote:

Andrei wrote:
Those headers look like the post was anonymized (anonymous_list = Yes) by Cleanse.py prior to MyHandler.py. Is there a "post to test-list from YOUR_ADDRESS anonymized" entry in Mailman's 'post' log?
Are you certain the list's anonymous_list setting is No?
Also, did you make any changes to MyHandler.py without restarting Mailman?
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan

Andrei wrote:
This would require a custom handler <http://wiki.list.org/x/l4A9> to rewrite the From: and add/replace/augment a Reply-to:
It can't be done with standard configuration settings.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan

Andrei wrote:
OK, thanks. Does anybody has a custom handler like that and is willing to share? I have no idea how to do this.
Something like this
from email.Utils import formataddr, getaddresses, parseaddr
def process(mlist, msg, msgdata): orig_from = parseaddr(msg.get('from')) orig_rt = msg.get_all('reply-to') del msg['from'] msg['From'] = formataddr((mlist.description, mlist.GetListEmail())) del msg['reply-to'] if orig_rt: rt_list = getaddresses(orig_rt) rt_addr = [x[1] for x in rt_list] if orig_from[1] not in rt_addr: rt_list += [orig_from] else: rt_list = [orig_from] msg['Reply-To'] = ', '.join([formataddr(x) for x in rt_list])
should do it. This will add the From: address to any existing Reply-To: if it isn't already there or create a Reply-To: if there wasn't one. It can go pretty much anywhere in the pipeline before ToDigest, but immediately before is good.
The list's anonymous_list and first_strip_reply_to must be No, and reply_goes_to_list must be Poster.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan

Thanks, Mark. I'm trying to use this just for one of the lists.
I added MyHandler.py in /var/lib/mailman/Mailman/Handlers, and in config_list added mlist.pipeline = [ 'Replybot', 'MyHandler', 'Moderate', 'ToOutgoing', ]
When I run config.list test-list I get
File "/usr/sbin/config_list", line 243, in <module> 'ToOutgoing', NameError: name 'mlist' is not defined
On Mon, Mar 11, 2013 at 12:35 PM, Mark Sapiro <mark@msapiro.net> wrote:

Andrei wrote:
I'm not sure what you mean by "in config_list added", but you should create an input file which contains only
mlist.pipeline = [ 'SpamDetect', 'Approve', 'Replybot', 'Moderate', 'Hold', 'MimeDel', 'Scrubber', 'Emergency', 'Tagger', 'CalcRecips', 'AvoidDuplicates', 'Cleanse', 'CleanseDKIM', 'CookHeaders', 'MyHandler', 'ToDigest', 'ToArchive', 'ToUsenet', 'AfterDelivery', 'Acknowledge', 'ToOutgoing', ]
I.e. it should look like the definition of GLOBAL_PIPELINE in Defaults.py with the addition of MyHandler immediately before ToDigest (and the comments removed).
Then you run
config_list -i path/to/above/file test-list
It looks like you may have modified the config_list program itself in some way rather than specifying the complete pipeline in an input file.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan

Sorry about that and thanks for your patience with this. I made all the changes. No errors are generated on config_list -i /home/files/config-file test-list However, when I send an email it gets delivered with unmodified reply-to header. From is replaced with the list name. When I hit reply, list address comes up, not the original sender address. I don't see anything in mailman error log. Here are the mail headers: http://pastebin.com/5qnms2wK From and Reply-to headers seem unchanged and are from the list (not the sender).
CAT /usr/lib/mailman/Mailman/Handlers/MyHandler.py #!/usr/bin/env python # from email.Utils import formataddr, getaddresses, parseaddr
def process(mlist, msg, msgdata): orig_from = parseaddr(msg.get('from')) orig_rt = msg.get_all('reply-to') del msg['from'] msg['From'] = formataddr((mlist.description, mlist.GetListEmail())) del msg['reply-to'] if orig_rt: rt_list = getaddresses(orig_rt) rt_addr = [x[1] for x in rt_list] if orig_from[1] not in rt_addr: rt_list += [orig_from] else: rt_list = [orig_from] msg['Reply-To'] = ', '.join([formataddr(x) for x in rt_list])
CAT CONFIG-FILE: mlist.pipeline = [ 'SpamDetect', 'Approve', 'Replybot', 'Moderate', 'Hold', 'MimeDel', 'Scrubber', 'Emergency', 'Tagger', 'CalcRecips', 'AvoidDuplicates', 'Cleanse', 'CleanseDKIM', 'CookHeaders', 'MyHandler', 'ToDigest', 'ToArchive', 'ToUsenet', 'AfterDelivery', 'Acknowledge', 'ToOutgoing', ]
On Mon, Mar 11, 2013 at 2:11 PM, Mark Sapiro <mark@msapiro.net> wrote:

Andrei wrote:
Those headers look like the post was anonymized (anonymous_list = Yes) by Cleanse.py prior to MyHandler.py. Is there a "post to test-list from YOUR_ADDRESS anonymized" entry in Mailman's 'post' log?
Are you certain the list's anonymous_list setting is No?
Also, did you make any changes to MyHandler.py without restarting Mailman?
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
participants (4)
-
- Andrei -
-
Joseph Brennan
-
Mark Sapiro
-
Stephen J. Turnbull