fml からメールを送る
概要
送り返すべきメールは
Mail::Delivery::Queue
を使い queue に入れられます。
queue に入ったメールは、のちに
FML::Process::QueueManager
クラスが(配送)処理をします。
queue ファイルは queue ディレクトリから pickup され、
Mail::Message で parse され
FML::Mailer 経由で
Mail::Delivery が配送処理をします。
queue ディレクトリ
queue ディレクトリは複数のディレクトリからなります。
new/
active/
deferred/
info/sender/
info/recipients/
info/ には envelope 情報が格納されます。
queue ファイルを作る時は、一旦 new/ に作成されます。
queue ファイルを作る作業が終了し、配送準備 OK となったら
new/ から active/ に移動されます。
つまり active/ にあるファイルは配送準備ができているものです。
queue ディレクトリをロックする
特定の $queue_id object ごとに lock() と unlock() メソッドを使い、
ロックをかけます。
ロックは active/$queue_id ファイルに対しての flock(2) システムコールです。
fml の中でどうするか?
sender にあるメッセージを送り返したい場合は、次のようにします。
$curproc->reply_message( "you are not a ML member." );
うーん、言語の変換はどこでどう指示するべき?
ファイルを送りたい場合や画像を送りたい場合は次のようにします。
$curproc->reply_message( {
type => "text/plain; charset=iso-2022-jp",
path => "/etc/fml/main.cf",
filename => "main.cf",
disposition => "main.cf example",
});
$curproc->reply_message( {
type => "image/gif",
path => "/some/where/logo001.gif",
filename => "logo.gif",
disposition => "attachment",
});