Mail-Address Check.pl: Unterschied zwischen den Versionen
Aus Si:Wiki von Siegrist SystemLösungen - Informatik und Rezepte
Sigi (Diskussion | Beiträge) |
Sigi (Diskussion | Beiträge) K (Sigi verschob die Seite Mail-Address Chk nach Mail-Address Check.pl) |
(kein Unterschied)
|
Version vom 26. Dezember 2015, 02:55 Uhr
#!/usr/bin/perl use strict; use IO::Socket::INET; sub TRUE { 1; } sub FALSE { 0; } if ( ($#ARGV + 1) < 3 ) { print "Usage: $0 < mailserver-to-check-for > < port-on-server-25-or-587 > < email-adress-to-check > \n"; exit; } my $server = shift; my $port = shift; my $address_to_check = shift; my $answer = ""; my $SOCKET = IO::Socket::INET->new( PeerAddr => "$server", PeerPort => "$port", Proto => 'tcp') || die "Error in create socket!: $!"; <$SOCKET>; print $SOCKET "HELO xy\n"; <$SOCKET>; print $SOCKET "RSET\n"; <$SOCKET>; print $SOCKET "MAIL FROM: addrecheck\@example.org\n"; <$SOCKET>; $answer = ""; print $SOCKET "RCPT TO: $address_to_check\n"; $answer = <$SOCKET>; #print "Answer: $answer\n"; close $SOCKET; exit FALSE if $answer !~ m/\s+ok/i; exit TRUE;