On 2017-02-13 at 16:57 -0700, Phillip Carroll wrote:
> BTW, is there some way to test just a conditional expression without
> actually running an email through? It would be nice to be able to call a
> function that would test just this one thing with various example data.
exim -bh 192.0.2.1 -be
Use an IP with reverse DNS to get $sender_host_name populated.
Use -bem /full/path/to/file instead of -be to get many more variables
populated.
% rlwrap exim -bh 131.111.8.88 -be
> $sender_host_name
hummus.csx.cam.ac.uk
> ${extract{-2}{.}{$sender_host_name}}.${extract{-1}{.}{$sender_host_name}}
ac.uk
% rlwrap exim -bh 131.111.8.88 -bem $PWD/00021071.eml
Return-path taken from "Return-path:" header line
> ${if eq{${extract{-2}{.}{$sender_host_name}}.${extract{-1}{.}{$sender_host_name}}}\
{${extract{-2}{.}{$return_path}}.${extract{-1}{.}{$return_path}}}{yes}{no}}
no
> ${if eq{${extract{-2}{.}{$sender_host_name}}.${extract{-1}{.}{$sender_host_name}}}\
{${extract{-2}{.}{$sender_host_name}}.${extract{-1}{.}{$sender_host_name}}}{yes}{no}}
yes
> ${if eq{${extract{-2}{.}{$sender_host_name}}.${extract{-1}{.}{$sender_host_name}}}\
{${extract{-2}{.}{$sender_host_name}}.${extract{-1}{.}{$sender_host_name}}}}
true
-Phil P