3.33. How do I accept or reject all addresses from a particular domain (e.g., wildcard addresses)?

See also What's the regex syntax for header filter rules (in privacy options-spam filters)?

Q: If I want postings from all non-members at a particular domain to be accepted, how do I go about doing that without adding them each individually?

A: It's in the instructions in the list admin interface. Go to the Privacy Options > Sender Filters. For "List of non-member addresses whose postings should be automatically accepted." it says:

Add member addresses one per line; start the line with a ^ character to designate a regular expression match.

For Python RegEx see: http://www.python.org/doc/current/lib/module-re.html

Well, here's an example:

  ^.*@example\.com$

This tells Mailman to accept Emails received by any sender from example.com - no matter if the one's subscribed or not.

If you wish to extend this to allow anyone from example.com or any subdomain of example.com to post, you could use the regex:

 ^.*[@.]example\.com$

Use the same technique for the other fields, such as "List of non-member addresses whose postings will be automatically rejected", if you want to automatically reject all mail from a given domain, etc....

You can also use the same technique in reverse to restrict membership to a single domain, or anywhere else where you want to do something for "everywhere but here".

For example, if you wished only people with email addresses at example.com to be able to subscribe, then in the Ban List one could enter:

 ^.*@(?!example\.com$)

Which tells Mailman to reject any subscription request not in example.com - the regex matches anyone who isn't in example.com, so they are therefore banned. If you wish to extend this to ban anyone whose address is not at example.com or any subdomain, you could use:

 ^.*@(?!(.*\.)?example\.com$)

Converted from the Mailman FAQ Wizard

This is one of many Frequently Asked Questions.

MailmanWiki: DOC/How do I accept or reject all addresses from a particular domain (e.g., wildcard addresses)? (last edited 2019-02-25 19:14:38 by msapiro)