Это старая версия документа.
Содержание
Mailman
Mailman - это программа с открыты кодом для управления обсуждениями по электронной почте и списками рассылки. Много почтовых рассылок по программам с открытым кодом (включая списки рассылки Ubuntu) используют Mailman в качестве программы почтовых списков. Она многофункциональна и проста в установке и управлении.
Установка
Mailman обеспечивает web интерфейс для администраторов и пользователей, использующих внешний почтовый сервер для отправки и приема почты. Он великолепно работает со следующими почтовыми серверами:
Postfix
Exim
Sendmail
Qmail
Мы рассмотрим как установить и настроить Mailman с web сервером Apache, а также с почтовым сервером Postfix или Exim. Если вы собираетесь устанавливать Mailman с другим почтовым сервером, обратитесь пожалуйста к разделу Ссылок.
Вам потребуется установить только один почтовый сервер и Postfix для Ubuntu является вариантом по умолчанию.
Apache2
Чтобы установить apache2 обратитесь к соответствующему разделу Установки.
Postfix
Для инструкций по установке и настройке Postfix смотрите раздел Postfix.
Exim4
Для установки Exim4 обратитесь к разделу по Exim4.
Когда exim4 устанавливается, его файлы настроек сохраняются в каталоге /etc/exim4. В Ubuntu по умолчанию файлы настройки exim4 разделены на несколько файлов. Вы можете это поменять, изменив следующую переменную в файле /etc/exim4/update-exim4.conf.
dc_use_split_config='true'
Mailman
Чтобы установить Mailman, выполните следующую команду в терминале:
sudo apt-get install mailman
Она скопирует установочные файлы в каталог /var/lib/mailman. Она также установит CGI сценарии в каталог /usr/lib/cgi-bin/mailman, создаст пользователя линукс list и его группу. Процесс mailman будет управляться этим пользователем.
Настройка
This section assumes you have successfully installed mailman, apache2, and postfix or exim4. Now you just need to configure them.
Apache2
An example Apache configuration file comes with Mailman and is placed in /etc/mailman/apache.conf. In order for Apache to use the config file it needs to be copied to /etc/apache2/sites-available:
sudo cp /etc/mailman/apache.conf /etc/apache2/sites-available/mailman.conf
This will setup a new Apache VirtualHost for the Mailman administration site. Now enable the new configuration and restart Apache:
sudo a2ensite mailman.conf sudo service apache2 restart
Mailman uses apache2 to render its CGI scripts. The mailman CGI scripts are installed in the /usr/lib/cgi-bin/mailman directory. So, the mailman url will be http://hostname/cgi-bin/mailman/. You can make changes to the /etc/apache2/sites-available/mailman.conf file if you wish to change this behavior.
Postfix
For Postfix integration, we will associate the domain lists.example.com with the mailing lists. Please replace lists.example.com with the domain of your choosing.
You can use the postconf command to add the necessary configuration to /etc/postfix/main.cf:
sudo postconf -e 'relay_domains = lists.example.com' sudo postconf -e 'transport_maps = hash:/etc/postfix/transport' sudo postconf -e 'mailman_destination_recipient_limit = 1'
In /etc/postfix/master.cf double check that you have the following transport:
mailman unix - n n - - pipe
flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py ${nexthop} ${user}
It calls the postfix-to-mailman.py script when a mail is delivered to a list.
Associate the domain lists.example.com to the Mailman transport with the transport map. Edit the file /etc/postfix/transport:
lists.example.com mailman:
Now have Postfix build the transport map by entering the following from a terminal prompt:
sudo postmap -v /etc/postfix/transport
Then restart Postfix to enable the new configurations:
sudo /etc/init.d/postfix restart
Exim4
Once Exim4 is installed, you can start the Exim server using the following command from a terminal prompt:
sudo /etc/init.d/exim4 start
In order to make mailman work with Exim4, you need to configure Exim4. As mentioned earlier, by default, Exim4 uses multiple configuration files of different types. For details, please refer to the Exim web site. To run mailman, we should add new a configuration file to the following configuration types:
Main
Transport
Router
Exim creates a master configuration file by sorting all these mini configuration files. So, the order of these configuration files is very important.
Main
All the configuration files belonging to the main type are stored in the /etc/exim4/conf.d/main/ directory. You can add the following content to a new file, named 04_exim4-config_mailman:
# start # Home dir for your Mailman installation – aka Mailman's prefix # directory. # On Ubuntu this should be «/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=hostname.com # # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # # 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
Transport
All the configuration files belonging to transport type are stored in the /etc/exim4/conf.d/transport/ directory. You can add the following content to a new file named 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
Router
All the configuration files belonging to router type are stored in the /etc/exim4/conf.d/router/ directory. You can add the following content in to a new file named 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
The order of main and transport configuration files can be in any order. But, the order of router configuration files must be the same. This particular file must appear before the 200_exim4-config_primary file. These two configuration files contain same type of information. The first file takes the precedence. For more details, please refer to the references section.
Mailman
Once mailman is installed, you can run it using the following command:
sudo /etc/init.d/mailman start
Once mailman is installed, you should create the default mailing list. Run the following command to create the mailing list:
sudo /usr/sbin/newlist mailman
Enter the email address of the person running the list: bhuvan at ubuntu.com Initial mailman password: To finish creating your mailing list, you must edit your /etc/aliases (or equivalent) file by adding the following lines, and possibly running the `newaliases' program:
## mailman mailing list mailman: "|/var/lib/mailman/mail/mailman post mailman" mailman-admin: "|/var/lib/mailman/mail/mailman admin mailman" mailman-bounces: "|/var/lib/mailman/mail/mailman bounces mailman" mailman-confirm: "|/var/lib/mailman/mail/mailman confirm mailman" mailman-join: "|/var/lib/mailman/mail/mailman join mailman" mailman-leave: "|/var/lib/mailman/mail/mailman leave mailman" mailman-owner: "|/var/lib/mailman/mail/mailman owner mailman" mailman-request: "|/var/lib/mailman/mail/mailman request mailman" mailman-subscribe: "|/var/lib/mailman/mail/mailman subscribe mailman" mailman-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe mailman"
Hit enter to notify mailman owner...
#
We have configured either Postfix or Exim4 to recognize all emails from mailman. So, it is not mandatory to make any new entries in /etc/aliases. If you have made any changes to the configuration files, please ensure that you restart those services before continuing to next section.
The Exim4 does not use the above aliases to forward mails to Mailman, as it uses a discover approach. To suppress the aliases while creating the list, you can add MTA=None line in Mailman configuration file, /etc/mailman/mm_cfg.py.
Управление
We assume you have a default installation. The mailman cgi scripts are still in the /usr/lib/cgi-bin/mailman/ directory. Mailman provides a web based administration facility. To access this page, point your browser to the following url:
http://hostname/cgi-bin/mailman/admin
The default mailing list, mailman, will appear in this screen. If you click the mailing list name, it will ask for your authentication password. If you enter the correct password, you will be able to change administrative settings of this mailing list. You can create a new mailing list using the command line utility (/usr/sbin/newlist). Alternatively, you can create a new mailing list using the web interface.
Пользователи
Mailman provides a web based interface for users. To access this page, point your browser to the following url:
http://hostname/cgi-bin/mailman/listinfo
The default mailing list, mailman, will appear in this screen. If you click the mailing list name, it will display the subscription form. You can enter your email address, name (optional), and password to subscribe. An email invitation will be sent to you. You can follow the instructions in the email to subscribe.