把用户添加到邮件列表里测试一些
,建一个文本文件
,比如members.txt,一行一个邮件地址,然后执行如下命令就可以了:
# /usr/local/mailman/bin/add_members -n members.txt mailman
3、postfix相关配置
还需要修改postfix的配置文件才能使mailman工作正常,修改main.cf,加上:
owner_request_ecial = no
recipient_delimiter = +
unknown_local_recipient_reject_code = 550
修改alias_ma和virtual_ma为:
alias_ma = hash:/usr/local/mailman/data/aliases,
mysql:/etc/postfix/
mysql-aliases.cf
virtual_ma = hash:/usr/local/mailman/data/virtual-mailman,
mysql:/etc/postfix/mysql-virtual.cf
单单这样还是不行的,我测试还需要把main.cf里myorigin改为:
myorigin = lists.test.org
然后在traort表里添加一个记录:
iert into traort set domain='lists.test.org',destination='local:';
重启postfix和mailman,现在可以试试给mailman这个邮件列表发邮件是否都正常了?
4、python处理中文的问题
如果邮件都是中文gb2312编码的就有问题,查看/usr/local/mailman/logs/error会发现如下的错误:
Jul 16 17:40:09 2003 (392) Uncaught ruer exception: unknown encoding
Jul 16 17:40:10 2003 (392) Traceback (most recent call last):
File "/usr/local/mailman/Mailman/Queue/Ruer.py", line 105, in _oneloop
self._onefile(msg, msgdata)
File "/usr/local/mailman/Mailman/Queue/Ruer.py", line 155, in _onefile
keepqueued = self._diose(mlist, msg, msgdata)
File "/usr/local/mailman/Mailman/Queue/IncomingRuer.py", line 130, in _diose
more = self._dopipeline(mlist, msg, msgdata, pipeline)
File "/usr/local/mailman/Mailman/Queue/IncomingRuer.py", line 153, in _dopipeline
sys.modules[modname].proce(mlist, msg, msgdata)
File "/usr/local/mailman/Mailman/Handlers/CookHeaders.py", line 75, in proce
prefix_subject(mlist, msg, msgdata)
File "/usr/local/mailman/Mailman/Handlers/CookHeaders.py", line 262, in prefix_subject
h.aend(s, c)
File "/usr/local/mailman/pythonlib/email/Header.py", line 285, in aend
s = s.encode(outcodec, errors)
LookupError: unknown encoding
Jul 16 17:40:10 2003 (392) SHUNTING: 1058348408.892736+4539457d44c4477c6393b0b8b9916993b6084898
这是由于python不支持gb2312的缘故!在
linuxforum找到一篇关于如何使python支持gb2312的文章:
http://www.XXXX..net/forum/showflat.php?Cat=&amoard=pythoamumber=
427317&amage=0&amview=collaed&am=5&amo=&amfpart=
我就用了作者提供的http://1.nju.edu.cn/file/gb2312.rar,其实它也是从http://sourceforge.net/projects/python-codecs/来的
。把gb2312目录的gb2312.py文件拷贝到/usr/lib/python2.1/encodings/目录下,chinesecn目录也拷贝到该目录下,然后修改/usr/lib/python2.1/encodings/aliases.py文件,在最后的}前加上:
# gb2321_cn codec
'gb2312': 'gb2312',