diff options
Diffstat (limited to 'example/vrfy')
-rwxr-xr-x | example/vrfy | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/example/vrfy b/example/vrfy new file mode 100755 index 0000000..49c1b18 --- /dev/null +++ b/example/vrfy @@ -0,0 +1,27 @@ +#!/depot/path/expect -f + + +# separate address into user and host +regexp (.*)@(.*) $argv ignore user host + +log_user 0 +set timeout -1 + +# host might be an mx record, convert to a real host via nslookup +spawn nslookup +expect "> " +send "set query=mx\r" +expect "> " +send "$host\r" +expect { + "No mail exchanger" {} + -re "mail exchanger = (\[^\r]*)" { + set host $expect_out(1,string) + } +} + +spawn telnet $host smtp +expect "220*\r\n" +send "vrfy $user\r" +expect "250" {send_user "GOOD\n"} \ + "550" {send_user "BAD\n"} |