File: vrfy

package info (click to toggle)
expect 5.45.4-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,016 kB
  • sloc: ansic: 17,965; sh: 7,445; tcl: 384; makefile: 191; exp: 10
file content (32 lines) | stat: -rwxr-xr-x 611 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
# -*- tcl -*-
# The next line is executed by /bin/sh, but not tcl \
exec tclsh "$0" ${1+"$@"}

package require Expect


# 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"}