
ezmlmのprefix設定方法
ezmlm設定メモ
■説明 ezmlmをインストールした後、デフォルトの設定では いろいろ不便なのでこれらの設定を行う。
ezmlmのprefixの振り方はとっても頭が悪いので、
fmlなどと同じようなprefixがふれるようにした
■デフォルトで、Reply-toがつくようにする
/usr/local/bin/ezmlm/ezmlmrc の321行目あたりに Reply-to: < #L#>@< #H#>
■デフォルトでprefixナンバーがつくように /usr/local/bin/ezmlm/ezmlmrc の440行目あたりに ]< #L#> #]
■きれいな通し番号を http://www.ep.sci.hokudai.ac.jp/~epnetfan/tebiki/server-ml/prefix.html 参照
/home/vpopmail/ に置く。
chown vpopmail.vchkpw /home/vpopmail/prefix.pl
chmod u+x /home/vpopmail/prefix.pl
250行目あたりコメントアウト #|< #B#>/ezmlm-send ’< #D#>’
これを追加 |/usr/bin/nkf -em |/home/vpopmail/prefix.pl < #L#> ‘/home/vpopmail/domains/< #H#>/< #L#>/num’ |/usr/bin/nkf -j |/usr/local/bin/ezmlm/ezmlm-send ‘/home/vpopmail/domains/< #H#>/< #L#>’
---------prefix.pl------------------------
#!/usr/bin/perl## This is a pert of the Dongury Perl library.# Copyright (C) 1999 Dongury Entertainment Corporation# All rights reserved.## Based on the program written by Kyoma TAKAHASHI.# Many thanks for his advice!## prefix.pl ver 0.3.6# modified by Yuki Matsukura 2003/10/11 <matsu @ht.sfc.keio.ac.jp>##########################################
$UseLock = 1; # True : 1, False : 0$FormatIndex = 4; # Index の桁数
#########################################
sub lock_file { local(*FILE) = @_; if ($UseLock) { eval("flock(FILE, 2)"); if ($@) { return 0; } } return 1;}
sub unlock_file { local(*FILE) = @_; if ($UseLock) { eval("flock(FILE, 8)"); }}
sub increment { my ($path) = @_; local $num; open(INDEX, "+< " . "$path") or return 0; if (!&lock_file(INDEX)) { close(INDEX); return 0; } chop ($num = <INDEX>);# Stop duplicated incrementation.# $num += 1; seek(INDEX, 0, 0); print INDEX "$num\n"; &unlock_file(INDEX); close(INDEX); return $num;}
sub main { my ($prefix, $index, $result);
shift; $prefix = $ARGV[0]; if (-e $ARGV[1]) { $index = &increment($ARGV[1]); } if ($index) { $index = sprintf('%.' . $FormatIndex . 'd', $index); } else { $index = "" unless $index; }
while (<stdin>) { chop; if (s/^Subject:]//) { s/((\|]|RE):])+/Re: /gi; s/^]$prefix]?\d+\]]*//;# disable extra prefix# s/Re:]]$prefix]?(\d+)\]]*/Re:[$1] /g; s/Re:]]$prefix]?(\d+)\](]*)/Re: $2/g; s/Re:]*Re:]*/Re: /g;
foreach $s (split) { if ($s =~ /Re:]\d+\]/ and $pre =~ /Re:]\d+\]/) { $pre = $s; $s =~ s/Re://g if (($s =~ /Re:]/) && (!$` or $` =~ /(Re:)+/)); $result .= $s; next; } $pre = $s; $result .= " $s"; } print "Subject: [$prefix $index]" . $result . "\n"; last; } print; print "\n"; } print </stdin><stdin>; exit(0);} ezmlmのprefix設定方法
https://diary.teraren.com/posts/2003-10-11-ezmlmnoprefixsetup/

