Differences between revisions 4 and 6 (spanning 2 versions)
Revision 4 as of 2015-01-31 02:36:58
Size: 2295
Editor: msapiro
Comment: Removed FAQ Wizard last edited
Revision 6 as of 2019-02-25 19:14:38
Size: 2280
Editor: msapiro
Comment: Simplified some regexp examples
Deletions are marked like this. Additions are marked like this.
Line 12: Line 12:
For Python RegEx see: [[http://www.python.org/doc/current/lib/module-re.html|http://www.python.org/doc/current/lib/module-re.html]] For Python !RegEx see: [[http://www.python.org/doc/current/lib/module-re.html|http://www.python.org/doc/current/lib/module-re.html]]
Line 17: Line 17:
  ^[^@]+@example\.com$   ^.*@example\.com$
Line 22: Line 22:
If you wish to extend this to allow anyone from example.com or any subdomain of example.com to post, you could use the regexp: 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:
Line 25: Line 25:
 ^[^@]+@(.*\.)?example\.com$  ^.*[@.]example\.com$
Line 35: Line 35:
 ^[^@]+@(?!example\.com$)  ^.*@(?!example\.com$)
Line 38: Line 38:
Which tells Mailman to reject any subscription request not in example.com - the regexp 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: 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:
Line 41: Line 41:
 ^[^@]+@(?!(.*\.)?example\.com$)  ^.*@(?!(.*\.)?example\.com$)

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)