以外と簡単だった。
local_system:
driver = redirect
file_transport = address_file
pipe_transport = address_pipe
data = ${lookup{$local_part}wildlsearch{/etc/aliases}}
# data = ${lookup{$local_part}lsearch{/etc/aliases}}
condition = "${if eq{$domain}{$primary_hostname} {yes}{no}}"
retry_use_local_part
pass_router = route_amavis
ACLは抜けるように設定。(うちはlocalにいれたけど、考えたらスパムにやられるかも・・・。ACLでlocalhostからのprimary_hostnameを許可した方がいいかも。)
送られてきたメールのdomain部分とprimary_hostnameが合った場合
/etc/aliasesファイルを見て転送する。
lsearchは通常の処理で無いものは処理しない。
wildsearchはワイルドカードが利用できるが多段の設定ができない。
例えば
test1:test
test2:test
test:postmaster
などとしても最初のしか適用されなくなる(らしい)
とりあえずすべてpostmaster宛に転送することにした。
*:postmaster
ちなみにうちのようなqmailとeximの多段設定で無ければこんな処理は必要ない。
qualifyの設定で問題ない。
Plesk&eximだと内部からのメールがqmailで発信される為に
こんな問題が発生するのだ・・・。
追記:
REWRITEを使えば上記の方法なんていりませーん(泣
まだ試してないけどそちらをご利用あれ・・・。
http://www.katontech.com/diary/?date=20050201
http://www.exim.org/exim-html-4.40/doc/html/spec_31.html#SECT31.4
E rewrite all envelope fields
F rewrite the envelope From field
T rewrite the envelope To field
b rewrite the Bcc: header
c rewrite the Cc: header
f rewrite the From: header
h rewrite all headers
r rewrite the Reply-To: header
s rewrite the Sender: header
t rewrite the To: header
問題なく動作しました。
*@mail.hoge.jp $1@hoge.jp Ebcfhrst
0 件のコメント:
コメントを投稿