Sieveの条件・配送actionとvacation2 / 4
条件とaction
require ["fileinto", "vacation"];
if header :contains "X-Spam-Flag" "YES" {
fileinto "Spam";
stop;
} elsif allof (address :domain :is "from" "example.test",
size :over 1M) {
fileinto "Large";
stop;
}
keep;
fileintoとvacationは使う拡張をrequireする。上例のheaderはraw header、addressはmail addressをparseしdomain部分等を照合する。envelopeを使う拡張ではSMTP envelopeの送受先を調べる。To headerに見えないBcc等を、headerだけで必ず判定できるとはしない。
:isは一致、:containsは含む、:matchesはwildcard等の比較で、allofはAND、anyofはOR、notは否定である。sizeの:over/:underはmessage sizeを比較し、1Mは1,048,576byteへ対応する。大小境界と単位をそろえる。