Differences between revisions 6 and 7
Revision 6 as of 2011-05-14 15:49:24
Size: 4389
Editor: msapiro
Comment: Added links to remove_bad_address.py script.
Revision 7 as of 2011-05-14 15:49:25
Size: 4579
Editor: msapiro
Comment: Migrated to Confluence 4.0
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
#pragma page-filename DOC/versions/14352509 #pragma page-filename DOC/versions/4030544
Line 3: Line 3:
Line 20: Line 21:
    * Before trying the method(s) below, first try Before trying the method(s) below, first try
Line 31: Line 33:
Note that this won't work if the invalid address contains leading or trailing whitespace. In that case, use the withlist removeMember() method described below or use the withlist script at [[http://www.msapiro.net/scripts/remove_bad_address.py]] (mirrored at [[http://fog.ccsf.cc.ca.us/~msapiro/scripts/remove_bad_address.py]]). Note that this won't work if the invalid address contains leading or trailing whitespace. In that case, use the withlist removeMember() method described below or use the withlist script at [[http://www.msapiro.net/scripts/remove_bad_address.py|http://www.msapiro.net/scripts/remove_bad_address.py]] (mirrored at [[http://fog.ccsf.cc.ca.us/~msapiro/scripts/remove_bad_address.py|http://fog.ccsf.cc.ca.us/~msapiro/scripts/remove_bad_address.py]]).
Line 33: Line 35:
    * To fix this, try using bin/withlist.
To fix this, try using bin/withlist.
Line 43: Line 47:
You may use C-style escapes, as well: {{{m.removeMember("\r\nname@example.com")}}} You may use C-style escapes, as well: `m.removeMember("\r\nname@example.com")`
Line 93: Line 97:
\----------------------------------------------------(\)-- ----------------------------------------------------
Line 95: Line 99:
Prior to Mailman 2.1.10, there was a bug that affected addresses of the form lower_case_user@Mixed_or_UPPER_case_domain. If you have such addresses on a list and they can't be removed, there is a withlist script to fix the problem at [[http://www.msapiro.net/scripts/fix_uc_address.py]] (mirrored at [[http://fog.ccsf.cc.ca.us/~msapiro/scripts/fix_uc_address.py]]).
<<Color2(Converted from the Mailman FAQ Wizard, col=darkgreen)>>This is one of many [[../Frequently Asked Questions|Frequently Asked Questions]].
Prior to Mailman 2.1.10, there was a bug that affected addresses of the form lower_case_user@Mixed_or_UPPER_case_domain. If you have such addresses on a list and they can't be removed, there is a withlist script to fix the problem at [[http://www.msapiro.net/scripts/fix_uc_address.py|http://www.msapiro.net/scripts/fix_uc_address.py]] (mirrored at [[http://fog.ccsf.cc.ca.us/~msapiro/scripts/fix_uc_address.py|http://fog.ccsf.cc.ca.us/~msapiro/scripts/fix_uc_address.py]]).

Converted from the Mailman FAQ Wizard

This is one of many [[../Frequently Asked Questions|Frequently Asked Questions]].

3.13. How do I remove a user name or email address with an illegal character in it (or Mixed or Upper case domain)?

This sort of thing might result in a subscriber address being corrupted, and errors like this:

Traceback (most recent call last):

  File "/usr/local/mailman/scripts/driver", line 87, in run_main
    main()
  File "/usr/local/mailman/Mailman/Cgi/admin.py", line 198, in main
    show_results(mlist, doc, category, subcat, cgidata)
  File "/usr/local/mailman/Mailman/Cgi/admin.py", line 501, in show_results
    form.AddItem(membership_options(mlist, subcat, cgidata, doc, form))
  File "/usr/local/mailman/Mailman/Cgi/admin.py", line 873, in membership_options
    all = [_m.encode() for _m in mlist.getMembers()]
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xa0 in position 22: ordinal not in range(128)

Before trying the method(s) below, first try

 % bin/list_members -i listname

If that lists the addresses you want removed, try

 % bin/list_members -i listname | bin/remove_members -f - listname

Note that this won't work if the invalid address contains leading or trailing whitespace. In that case, use the withlist removeMember() method described below or use the withlist script at http://www.msapiro.net/scripts/remove_bad_address.py (mirrored at http://fog.ccsf.cc.ca.us/~msapiro/scripts/remove_bad_address.py).

To fix this, try using bin/withlist.

If you have a bad address such as "na,me@example.com" that should be corrected to "name@example.com" you would do the following:

 % bin/withlist -l mylist
 >>> m.removeMember('na,me@example.com')
 >>> m.Save()
 >>> ^D

You may use C-style escapes, as well: m.removeMember("\r\nname@example.com")

This is the preferred method since it cleans out any other information in the database associated with the bogus address, but if it raises exceptions and doesn't remove the member you should do one of the following (and submit a bug report!)

If the member is a regular member

 % bin/withlist -l mylist
 >>> del m.members['na,me@example.com']
 >>> m.Save()
 >>> ^D

If the member is a digest member

 % bin/withlist -l mylist
 >>> del m.digest_members['na,me@example.com']
 >>> m.Save()
 >>> ^D

Email addresses may only contain ASCII characters. Older versions of Mailman allowed non-ASCII characters as email addresses sometimes. This has since been fixed, but some older lists may have bogus addresses in them. Here's a command line recipe that might help clear all of these out:

 % bin/find_member -l listname "[^\w\-+@.%]" > file

This will give you an list of bad addresses, but you will need to edit the list to remove language such as 'found in', etc to make it only a list of email addresses that can be used by the following command:

 % bin/remove_members -f file listname

Also, you may need to adjust the regular expression used by find_member.

If you are told when trying to remove the invalid members that the invalid members do not exist, instead of saving the invalid members to a file first which can cause problems with some invalid characters, you can use a pipe to do this in one step:

 % bin/list_members -i listname | bin/remove_members -f - listname

If the above methods don't work, you can try

 % bin/list_members -f listname | grep -v -e 'pattern' | bin/sync_members -f - listname

where listname is the name of the list and pattern is a pattern that will match the bad address. Alternatively, you can direct the output of bin/list_members to a file, edit the file to remove the unwanted address(es) and than use it as input to bin/sync_members.


Prior to Mailman 2.1.10, there was a bug that affected addresses of the form lower_case_user@Mixed_or_UPPER_case_domain. If you have such addresses on a list and they can't be removed, there is a withlist script to fix the problem at http://www.msapiro.net/scripts/fix_uc_address.py (mirrored at http://fog.ccsf.cc.ca.us/~msapiro/scripts/fix_uc_address.py).

Converted from the Mailman FAQ Wizard

This is one of many Frequently Asked Questions.

MailmanWiki: DOC/How do I remove a user name or email address with an illegal character in it (or Mixed or Upper case domain)? (last edited 2020-01-28 18:02:16 by IanKelling)