构建反病毒反垃圾邮件系统(八)_Mail服务器教程

编辑Tag赚U币
教程Tag:暂无Tag,欢迎添加,赚取U币!
  把用户添加到邮件列表里测试一些,建一个文本文件,比如members.txt,一行一个邮件地址,然后执行如下命令就可以了:

  # /usr/local/mailman/bin/add_members -n members.txt mailman

  3、postfix相关配置

  还需要修改postfix的配置文件才能使mailman工作正常,修改main.cf,加上:

  owner_request_special = no
  recipient_delimiter = +
  unknown_local_recipient_reject_code = 550

  修改alias_maps和virtual_maps为:

  alias_maps = hash:/usr/local/mailman/data/aliases,
  mysql:/etc/postfix/mysql-aliases.cf
  virtual_maps = hash:/usr/local/mailman/data/virtual-mailman,
  mysql:/etc/postfix/mysql-virtual.cf

  单单这样还是不行的,我测试还需要把main.cf里myorigin改为:

  myorigin = lists.test.org

  然后在transport表里添加一个记录:

  insert into transport 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 runner exception: unknown encoding
  Jul 16 17:40:10 2003 (392) Traceback (most recent call last):
  File "/usr/local/mailman/Mailman/Queue/Runner.py", line 105, in _oneloop
  self._onefile(msg, msgdata)
  File "/usr/local/mailman/Mailman/Queue/Runner.py", line 155, in _onefile
  keepqueued = self._dispose(mlist, msg, msgdata)
  File "/usr/local/mailman/Mailman/Queue/IncomingRunner.py", line 130, in _dispose
  more = self._dopipeline(mlist, msg, msgdata, pipeline)
  File "/usr/local/mailman/Mailman/Queue/IncomingRunner.py", line 153, in _dopipeline
  sys.modules[modname].process(mlist, msg, msgdata)
  File "/usr/local/mailman/Mailman/Handlers/CookHeaders.py", line 75, in process
  prefix_subject(mlist, msg, msgdata)
  File "/usr/local/mailman/Mailman/Handlers/CookHeaders.py", line 262, in prefix_subject
  h.append(s, c)
  File "/usr/local/mailman/pythonlib/email/Header.py", line 285, in append
  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=&Board=python&Number=
427317&page=0&view=collapsed&sb=5&o=&fpart=

  我就用了作者提供的http://bbs1.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',

来源:网络搜集//所属分类:Mail服务器教程/更新时间:2013-04-15
相关Mail服务器教程