>From what I can tell, lmtpengine.c:lmtpmod() calls lmtpengine.c:savemsg() to read the message and get it onto disk, then lmtpd.c:deliver() to call sieve rules and deliver the message.
lmtpengine.c:savemsg() calls fprintf() to add the Return-Path header to the output on disk. lmtpengine.c:fill_cache() loops over input, reading headers one by one, adding to the header cache. lmtpd.c:deliver() matches headers from the header cache. But, since lmtpengine.c:savemsg() never adds the generated Return-Path to the cache, so the generated Return-Path can't be matched against. This is also the case for the locally generated Received: header. While there may not be much call to match against the last-hop received header (unless maybe you want to take different actions depending on the origin of mail from different remote last-hop LMTP mta's), there is interest (at least here) for being able to filter on return-path. Would you (CMU) take a patch splitting fill_cache into two parts -- fill_cache() and insert_cache_element()? insert_cache_element() could then be used earlier in savemsg() to insert the generated headers into the header cache so that sieve recipes could use them. Does that sound like the correct fix? -Chris On Mon, 22 Sep 2003, Chris Stromsoe wrote: > Before I start digging through the source, does lmtpd add the > Return-Path header before or after calling sieve routines? The first > recipe below works, the second does not. > > # works > require ["fileinto","regex"]; > if allof (header :regex "From" ".*") { > fileinto "test1"; > } > > #fails > require ["fileinto","regex"]; > if allof (header :regex "Return-Path" ".*") { > fileinto "test1"; > } > > > > > -Chris >