■qmailadminインストール

(1)autorespondインストール
 

[root@centos ~]# wget http://www.inter7.com/devel/autorespond-2.0.5.tar.gz ← autorespondダウンロード

※最新版のURLはダウンロードページで確認すること

[root@centos ~]# tar zxvf autorespond-2.0.5.tar.gz ← autorespond展開

[root@centos ~]# cd autorespond-2.0.5 ← autorespond展開先ディレクトリへ移動

[root@centos autorespond-2.0.5]# vi autorespond.c ← autorespond.c編集
static char *binqqargs[2] = { "bin/qmail-queue", 0 };
↓
static char *binqqargs[2] = { "bin/qmail-queue.iso-2022-jp", 0 }; ← 変更

        fprintf(fdm,"Date: %u %s %u %02u:%02u:%02u -0000\nMessage-ID: <%lu.%u.blah>\n"
                ,dt->tm_mday,montab[dt->tm_mon],dt->tm_year+1900,dt->tm_hour,dt->tm_min,dt->tm_sec,msgwhen,getpid() );

        fprintf(fdm,"Content-Type: text/plain; charset=\"ISO-2022-JP\"\n" ); ← 追加

        mfp = fopen( msg, "rb" );

[root@centos autorespond-2.0.5]# make && make install ← autorespondインストール
gcc -O2 -Wall -g  autorespond.c -o autorespond
install -d /usr/bin /usr/share/man/man1
install autorespond /usr/bin
install autorespond.1 /usr/share/man/man1

[root@centos autorespond-2.0.5]# cd ← autorespond展開先ディレクトリを抜ける

[root@centos ~]# rm -rf autorespond-2.0.5 ← autorespond展開先ディレクトリ削除

[root@centos ~]# rm -f autorespond-2.0.5.tar.gz ← ダウンロードしたautorespond削除

[root@centos ~]# vi /var/qmail/bin/qmail-queue.iso-2022-jp ← autorespond返信メール日本語化スクリプト作成
#!/bin/bash

NKF="/usr/bin/nkf"
PERL="/usr/bin/perl"
QMAILQUEUE="/var/qmail/bin/qmail-queue"

${PERL} -pe 's/\n/\\n/g' |\
${PERL} -pe 's/From:.*?\\n\\n//' |\
${PERL} -pe 's/-------- Original Message --------.*$//' |\
${PERL} -pe 's/\\n/\n/g' |\
${NKF} -j |\
${QMAILQUEUE}

[root@centos ~]# chmod 711 /var/qmail/bin/qmail-queue.iso-2022-jp ← autorespond返信メール日本語化スクリプトパーミッション変更

[root@centos ~]# chown vpopmail. /var/qmail/bin/qmail-queue.iso-2022-jp ← autorespond返信メール日本語化スクリプト所有者変更

 

autorespond返信メールの日本語化参考
(2)ezmlmインストール
 

[root@centos ~]# wget http://cr.yp.to/software/ezmlm-0.53.tar.gz ← ezmlmダウンロード

※最新版のURLはダウンロードページで確認すること

[root@centos ~]# wget http://www.ezmlm.org/archive/5.1.1/ezmlm-idx-5.1.1.tar.gz ← ezmlm-idxダウンロード

※最新版のURLはダウンロードページで確認すること

[root@centos ~]# tar zxvf ezmlm-0.53.tar.gz ← ezmlm展開

[root@centos ~]# tar zxvf ezmlm-idx-5.1.1.tar.gz ← ezmlm-idx展開

[root@centos ~]# /bin/cp -r ezmlm-idx-5.1.1/* ezmlm-0.53 ← ezmlm-idx展開先ディレクトリ内全ファイルをezmlm展開先ディレクトリへコピー

[root@centos ~]# cd ezmlm-0.53 ← ezmlm展開先ディレクトリへ移動

[root@centos ezmlm-0.53]# patch < idx.patch ← ezmlm-idxパッチ施行
patching file auto-str.c
patching file case_startb.c
patching file constmap.c
patching file constmap.h
patching file cookie.c
patching file cookie.h
patching file date822fmt.c
patching file date822fmt.h
patching file datetime.c
patching file datetime.h
patching file envread.c
patching file ezmlm-list.1
patching file ezmlm-return.1
patching file ezmlm-send.1
patching file ezmlm-sub.1
patching file ezmlm-unsub.1
patching file ezmlm-warn.1
patching file ezmlm-weed.1
patching file ezmlm-weed.c
patching file ezmlm.5
patching file fmt_str.c
patching file fork.h1
patching file fork.h2
patching file getconf.c
patching file getln.c
patching file getln2.c
patching file install.c
patching file log.c
patching file make-load.sh
patching file now.c
patching file now.h
patching file open_append.c
patching file open_read.c
patching file quote.c
patching file readwrite.h
patching file scan_8long.c
patching file sig_catch.c
patching file sig_pipe.c
patching file slurp.c
patching file slurpclose.c
patching file str_cpy.c
patching file str_diffn.c
patching file stralloc_arts.c
patching file strerr.c
patching file strerr.h
patching file strerr_die.c
patching file strerr_sys.c
patching file substdi.c
patching file substdio.c
patching file substdio.h
patching file substdio_copy.c
patching file substdo.c
patching file surf.c
patching file surfpcs.c

[root@centos ezmlm-0.53]# echo ja > conf-lang ← メーリングリストシステムからのメールの日本語化

[root@centos ezmlm-0.53]# echo c:::644:/ja/:charset:lang/ja/charset >> ETC ← メーリングリストシステムからのメールの日本語化

[root@centos ezmlm-0.53]# make && make setup ← インストール

[root@centos ezmlm-0.53]# cd ← ezmlm展開先ディレクトリを抜ける

[root@centos ~]# rm -rf ezmlm-0.53 ← ezmlm展開先ディレクトリ削除

[root@centos ~]# rm -rf ezmlm-idx-5.1.1 ← ezmlm-idx展開先ディレクトリ削除

[root@centos ~]# rm -f ezmlm-0.53.tar.gz ← ダウンロードしたezmlm削除

[root@centos ~]# rm -f ezmlm-idx-5.1.1.tar.gz ← ダウンロードしたezmlm-idx削除

 

(3)qmailadminインストール
 

[root@centos ~]# wget http://jaist.dl.sourceforge.net/sourceforge/qmailadmin/qmailadmin-1.2.9.tar.gz ← qmailadminダウンロード

※qmailadminの最新版のURLはqmailadminダウンロードページで確認すること

[root@centos ~]# tar zxvf qmailadmin-1.2.9.tar.gz ← qmailadmin展開

[root@centos ~]# cd qmailadmin-1.2.9 ← qmailadmin展開先ディレクトリへ移動

[root@centos qmailadmin-1.2.9]# vi template.c ← ログインページでのqmailadmin、vpopmailのバージョン非表示化
          /* show version number */
          case 'V':
            printf("<a href=\"http://sourceforge.net/projects/qmailadmin/\">%s</a> %s<BR>",
              QA_PACKAGE, QA_VERSION);
            printf("<a href=\"http://www.inter7.com/vpopmail/\">%s</a> %s<BR>",
              PACKAGE, VERSION);
            break;
     ↓変更
          /* show version number */
          case 'V':
             printf("<a href=\"http://sourceforge.net/projects/qmailadmin/\">%s</a><BR>",
              QA_PACKAGE);
            printf("<a href=\"http://www.inter7.com/vpopmail/\">%s</a><BR>",
              PACKAGE);
            break;

[root@centos qmailadmin-1.2.9]# ./configure --enable-htmldir=/var/www/qmailadmin \
--enable-imagedir=/var/www/qmailadmin/images \
--enable-imageurl=/qmailadmin/images \
--enable-ezmlm-mysql=n \
--enable-help ← configure

[root@centos qmailadmin-1.2.9]# make && make install-strip ← qmailadminインストール

[root@centos qmailadmin-1.2.9]# cd ← qmailadmin展開先ディレクトリを抜ける

[root@centos ~]# rm -rf qmailadmin-1.2.9 ← qmailadmin展開先ディレクトリ削除

[root@centos ~]# rm -f qmailadmin-1.2.9.tar.gz ← ダウンロードしたqmailadmin削除

[root@centos ~]# wget http://jaist.dl.sourceforge.net/sourceforge/qmailadmin/qmailadmin-help-1.0.8.tar.gz ← qmailadmin-helpダウンロード

※qmailadmin-helpの最新版のURLはqmailadmin-helpダウンロードページで確認すること

[root@centos ~]# tar zxvf qmailadmin-help-1.0.8.tar.gz ← qmailadmin-help展開

[root@centos ~]# mkdir /var/www/qmailadmin/images/help ← qmailadmin-help格納先ディレクトリ作成

[root@centos ~]# cp -rp qmailadmin-help-1.0.8/* /var/www/qmailadmin/images/help ← qmailadmin-helpを上記ディレクトリへコピー

[root@centos ~]# rm -rf qmailadmin-help-1.0.8 ← qmailadmin-help展開先ディレクトリ削除

[root@centos ~]# rm -f qmailadmin-help-1.0.8.tar.gz ← ダウンロードしたqmailadmin-help削除

 

 

■qmailadmin設定

(1)qmailadminWebページアクセス設定
 

[root@centos ~]# vi /etc/httpd/conf.d/qmailadmin.conf ← qmailadminWebページアクセス設定ファイル作成
Alias /qmailadmin /var/www/qmailadmin

以下は内部からのみアクセスできるようにする場合のみ
<Directory "/var/www/cgi-bin">
  <Files "qmailadmin">
    order deny,allow
    deny from all
    allow from 127.0.0.1
    allow from 192.168.1 ← 内部ネットワークアドレスを指定
  </Files>
</Directory>

[root@centos ~]# /etc/rc.d/init.d/httpd reload ← Apache設定反映
httpd を再読み込み中:                                      [  OK  ]

 

(2)httpsアクセス設定
ユーザ名、パスワードの盗聴対策として基本的にhttps(SSL)でアクセスするようにするが、万が一通常のhttpでアクセスしても自動的にhttpsへ切り替えるようにする
 

virtualhostを使用してない場合】
[root@centos ~]# vi /etc/httpd/conf.d/rewrite.conf ← https(SSL)へのリダイレクト設定ファイル作成
<IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteLog "logs/rewrite_log"
      RewriteLogLevel 0
      RewriteCond %{SERVER_PORT} !^443$
      RewriteRule ^/cgi-bin/qmailadmin(.*)?$ https://%{HTTP_HOST}/cgi-bin/qmailadmin [L,R]
</IfModule>

virtualhostを使用している場合】
[root@centos ~]# vi /etc/httpd/conf.d/virtualhost.conf ← バーチャルホスト設定ファイル編集
<VirtualHost *:80>
    ServerName centossrv.com
    DocumentRoot /var/www/html
--追加(ここから)--
    <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteLog "logs/rewrite_log"
      RewriteLogLevel 0
      RewriteCond %{SERVER_PORT} !^443$
      RewriteRule ^/cgi-bin/qmailadmin(.*)?$ https://%{HTTP_HOST}/cgi-bin/qmailadmin [L,R]
    </IfModule>
--追加(ここまで)--
</VirtualHost>

[root@centos ~]# /etc/rc.d/init.d/httpd reload ← Apache設定反映
httpd を再読み込み中:                                      [  OK  ]

 

 

■qmailadmin確認

http://サーバーIPアドレス/cgi-bin/qmailadminへアクセスしてqmailadminログインページが表示されることと、URLがhttps://サーバーIPアドレス/cgi-bin/qmailadminになっていることを確認

※ログインページの「ユーザーアカウント」欄、「ドメイン名」欄に初期値でユーザ名、ドメイン名を表示させたい場合は、https://サーバーIPアドレス/cgi-bin/qmailadmin?user=ユーザ名&dom=ドメイン名というURLでアクセスする

※ログインページの「ユーザーアカウント」欄に初期値で「postmaster」と表示させたくない場合は、https://サーバーIPアドレス/cgi-bin/qmailadmin?user=というURLでアクセスする

(1)ユーザー追加
https://サーバー名/cgi-bin/qmailadminへアクセス

「ユーザーアカウント」⇒postmaster
「ドメイン名」⇒ドメイン名
「パスワード」⇒/home/vpopmail/bin/vadddomainコマンドでドメイン追加時に指定したpostmasterのパスワード
「Login」ボタン押下

「新しいPOPアカウント」リンクをクリック

「POPアカウント」⇒ユーザー名
「パスワード」⇒パスワード
「パスワード(再入力)」⇒パスワード(確認)
「追加」ボタン押下

ユーザーが追加された

(2)ユーザー削除
https://サーバー名/cgi-bin/qmailadminへアクセス

「ユーザーアカウント」⇒postmaster
「ドメイン名」⇒ドメイン名
「パスワード」⇒/home/vpopmail/bin/vadddomainコマンドでドメイン追加時に指定したpostmasterのパスワード
「Login」ボタン押下

「POPアカウント」リンクをクリック

削除するユーザーのゴミ箱アイコンをクリック

「削除を承認」ボタン押下

ユーザーが削除された

(3)パスワード変更
https://サーバー名/cgi-bin/qmailadminへアクセス

「ユーザーアカウント」⇒ユーザー名
「ドメイン名」⇒ドメイン名
「パスワード」⇒パスワード
「Login」ボタン押下

「新パスワード」⇒新パスワード
「パスワード(再入力)」⇒新パスワード(確認)
「ユーザーを修正」ボタン押下

パスワードが変更された

(4)メール転送設定
https://サーバー名/cgi-bin/qmailadminへアクセス

「ユーザーアカウント」⇒ユーザー名
「ドメイン名」⇒ドメイン名
「パスワード」⇒パスワード
「Login」ボタン押下

「転送先メールアドレス」をチェックして転送先メールアドレスを入力
「転送元メールアドレスと転送先メールアドレスを有効にする」をチェック※メールボックスにメールを残した上で転送先メールアドレス宛にメールを転送する場合
「ユーザーを修正」ボタン押下

(5)メール自動返信設定
https://サーバー名/cgi-bin/qmailadminへアクセス

「ユーザーアカウント」⇒ユーザー名
「ドメイン名」⇒ドメイン名
「パスワード」⇒パスワード
「Login」ボタン押下

「不在通知設定を有効にする」をチェック
「不在通知の件名」⇒自動返信メール件名
「不在通知の本文」⇒自動返信メール本文
「ユーザーを修正」ボタン押下

これで、上記自動返信設定ユーザー宛にメールを送ると、自動返信メールが返信されてくるようになる

 

■qmailadmin確認(ezmlm編)

ezmlm(メーリングリスト機能)の確認を行う

(1)メーリングリスト作成
https://サーバー名/cgi-bin/qmailadminへアクセス

「ユーザーアカウント」⇒postmaster
「ドメイン名」⇒ドメイン名
「パスワード」⇒/home/vpopmail/bin/vadddomainコマンドでドメイン追加時に指定したpostmasterのパスワード
「Login」ボタン押下

「新しいメーリングリスト」リンクをクリック

「メーリングリスト名」⇒メーリングリスト名(例:test-ml)
「リストオーナーのメールアドレス」⇒メーリングリスト管理者メールアドレス
「プレフィックス」⇒「メーリングリスト名:#」(例:test-ml:#)※メーリングリストからのメールの件名に記事№を付加したい場合
「リストオプション」の「返信先」⇒「リスト全体」を選択※メーリングリストからのメールへの返信メールをメーリングリストに送信する場合

「追加」ボタン押下

(2)メーリングリストへの入会
「ML名-subscribe@サーバー名(例:test-ml-subscribe@centossrv.com)」宛に空メールを送り、返信されてきたメールへそのまま返信することによりメーリングリストへ入会できる

(3)メーリングリストへの投稿
「ML名@サーバー名(例:test-ml@centossrv.com)」へメールを送ることにより、ML登録ユーザ全員宛にメールが送られる

(4)メーリングリストからの退会
「ML名-unsubscribe-自分のメアド(ただし@は=にする)@サーバー名(例:test-ml-unsubscribe-test=test.com@centossrv.com)」宛に空メールを送り、返信されてきたメールへそのまま返信することによりメーリングリストから退会できる