Mailman
Some tips on using mailman
I am using the standard Ubuntu package. This means things are symlinked from the normal places in /var to where they are really installed in /usr
User.group = list.list not the usual mailman.mailman
Various config files including mm_cfg.py are in /etc/mailman I am using postfix as the MTA
Pipermail is installed
master.cf has this /usr/lib/mailman/bin/postfix-to-mailman.py
Notes in mailman docs
Integrating Postfix with Mailman
Create a list
http://hupi.org/mailman/create
Move a list from a different server
Spam control
Postgrey
I am using postgrey (installed from Ubuntu package).
Home page http://postgrey.schweikert.ch/
See http://www.howtoforge.com/greylisting_postfix_postgrey
Postgrey simply sends a message back on first connection refusing email and saying "come back later". It then creates a database (whitelist) entry and if the server connects to try again, lets it through.
NOQUEUE: reject: RCPT from oproxy2-pub.bluehost.com[67.222.39.60]: 450 4.2.0 <[email protected]>: Recipient address rejected: Greylisted, see http://postgrey.schweikert.ch/help/hupi.org.html; from=<[email protected]> to=<[email protected]> proto=SMTP helo=<oproxy2-pub.bluehost.com>
You can whitelist anyone manually by editing these files.
/etc/postgrey/whitelist_clients /etc/postgrey/whitelist_recipients
Local (internal) mail is unaffected.
Databases are in /var/lib/postgrey/
Dump current whitelist database
perl /usr/share/doc/postgrey/postgrey_clients_dump
See also
man postgreyreport
More anti-spam
Script to mass remove bouncing users
Puts a list of commands in /tmp/list that you then run as a script on the mailman server.
#!/usr/bin/env python # # 1 Read Brian's mailbox # 2 Build a list of addresses to unsubscribe # 3 Delete the emails # import re import imaplib from email.parser import Parser user = '[email protected]' password = 'xxxxxxxxx' host = 'imap.googlemail.com' mailbox = 'Inbox' port = 993 d_collection = {} re_mailing_list = re.compile(r'^http://hupi.org/cgi-bin/mailman/options/([^/]+)/(.*)%40(.*)\r') def process_message(text): for line in text.split('\n'): mo = re_mailing_list.search(line) if mo: user = mo.group(2) + '@' + mo.group(3) if user in d_collection: d_collection[user] += 1 else: d_collection[user] = 1 return def read_and_process_mail(): mbox = imaplib.IMAP4_SSL(host,port) rc, resp = mbox.login(user, password) print rc, resp mbox.select(mailbox) typ, data = mbox.search(None, 'TO', '[email protected]') i = 0 for num in data[0].split(): typ, data = mbox.fetch(num, '(BODY[TEXT])') process_message(data[0][1]) print "%d" % i i += 1 mbox.store(num,'+FLAGS', '\\Deleted') mbox.expunge() mbox.close() mbox.logout() read_and_process_mail() fp = open('/tmp/list', 'w') for k in d_collection: fp.write(k + "\n") print k fp.close()