当前位置: 首页 > 工具软件 > Mailman > 使用案例 >

ubuntu安装mailman详解

王英彦
2023-12-01

ubuntu安装mailman详解

最近上手一个测试项目,需要安装一款邮件分发系统mailman,找了各种教程,试了各种方法,最后决定还是将自己踩过的坑详细记下来,便于日后使用。以下是安装mailman的详细过程。

环境:ubuntu19

一、安装

  1. 更新源

    重要的说三遍,更新你的源、源、源
    sudo apt update

  2. 安装apache2
    sudo apt install apache2

  3. 安装exim4
    sudo apt install exim4

  4. 安装postfix
    sudo apt install postfix
    安装过程中选择 Internet Site,系统邮件名称自己起

  5. 安装mailman
    sudo apt install mailman
    使用space键选择你想使用的语言,并且设置你的默认语言

二、配置

  1. 配置Main
    进入main目录
    cd /etc/exim4/conf.d/main/

    创建文本04_exim4-config_mailman并复制以下内容
    vi 04_exim4-config_mailman

# start
# Home dir for your Mailman installation -- aka Mailman's prefix
# directory.
# By default this is set to "/usr/local/mailman"
# On a Red Hat/Fedora system using the RPM use "/var/mailman"
# On Debian using the deb package use "/var/lib/mailman"
# This is normally the same as ~mailman
MM_HOME=/var/lib/mailman
#
# User and group for Mailman, should match your --with-mail-gid
# switch to Mailman's configure script.  Value is normally "mailman"
MM_UID=list
MM_GID=list
#
# Domains that your lists are in - colon separated list
# you may wish to add these into local_domains as well
domainlist mm_domains=bluestar.co.in
#
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
# These values are derived from the ones above and should not need
# editing unless you have munged your mailman installation
#
# The path of the Mailman mail wrapper script
MM_WRAP=MM_HOME/mail/mailman
#
# The path of the list config file (used as a required file when
# verifying list addresses)
MM_LISTCHK=MM_HOME/lists/${lc::$local_part}/config.pck
# end
  1. 配置Transport
    进入transport目录
    cd /etc/exim4/conf.d/transport/

    创建文本40_exim4-config_mailman并复制以下内容
    vi 40_exim4-config_mailman

mailman_transport:
driver = pipe
command = MM_WRAP \
'${if def:local_part_suffix \
{${sg{$local_part_suffix}{-(\\w+)(\\+.*)?}{\$1\}\}\} \
{post}}' \
$local_part
current_directory = MM_HOME
home_directory = MM_HOME
user = MM_UID
group = MM_GID
  1. 配置Router
    进入Router目录
    cd /etc/exim4/conf.d/router/

    创建文本101_exim4-config_mailman并复制以下内容

mailman_router:
driver = accept
require_files = MM_HOME/lists/$local_part/config.pck
local_part_suffix_optional
local_part_suffix = -bounces : -bounces+* : \
-confirm+* : -join : -leave : \
-owner : -request : -admin
transport = mailman_transport
  1. 配置main.cf
    编辑main.cf,在末尾复制以下内容
    vi /etc/postfix/main.cf
relay_domains = lists.example.com
transport_maps = hash:/etc/postfix/transport
mailman_destination_recipient_limit = 1
  1. 配置transport
    创建transport并添加以下内容
    vi /etc/postfix/transport
lists.example.com      mailman:
  1. 添加邮件列表
    newlist mailman
    输入你的发送邮件地址,管理员密码

三、启用cgi

按顺序执行以下命令

sudo cp /etc/mailman/apache.conf /etc/apache2/sites-available/mailman.conf
sudo a2ensite mailman.conf
sudo a2enmod cgi

四、启动

  1. 启动exim4

    sudo /etc/init.d/exim4 start

  2. 启动apche2

    sudo service apache2 start
    如果已经启动则重启
    sudo service apache2 restart

  3. 启动mailman
    sudo service mailman start

结束,访问
http://hostname/cgi-bin/mailman/listinfo

 类似资料: