Mail-Address Check.pl: Unterschied zwischen den Versionen
Aus Si:Wiki von Siegrist SystemLösungen - Informatik und Rezepte
Sigi (Diskussion | Beiträge) K (Sigi verschob die Seite Mail-Address Chk nach Mail-Address Check.pl) |
Sigi (Diskussion | Beiträge) |
||
Zeile 2: | Zeile 2: | ||
#!/usr/bin/perl | #!/usr/bin/perl | ||
+ | |||
+ | # Copyright (c) 2015 by Peter_Siegrist(SystemLoesungen) (PSS @ ZweierNet.ch) | ||
+ | # pss.ZweierNet.ch | ||
+ | # | ||
+ | # This program is absolutely free software. | ||
+ | # Use it as you like but don't point the finger of blame to me. | ||
+ | # | ||
use strict; | use strict; |
Aktuelle Version vom 26. Dezember 2015, 03:04 Uhr
#!/usr/bin/perl # Copyright (c) 2015 by Peter_Siegrist(SystemLoesungen) (PSS @ ZweierNet.ch) # pss.ZweierNet.ch # # This program is absolutely free software. # Use it as you like but don't point the finger of blame to me. # 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;