in reply to Checking SMTP ports.
If the request was sucessful each line should be prepended by a 2xx status code and SMTP in the line.
$line =~ /^2\d\d .*SMTP/ should work as a rudimentary test for the first line back.
Update:
use strict; use warnings; use Net::Telnet; my $tel = Net::Telnet->new(-host => 'localhost', -port => 25, -errmode + => 'return') or die "Port not available\n"; my $rtn = $tel->getline() or die "No Reponse\n"; print $rtn =~ /^2\d\d .*SMTP/ ? 'OK' : 'Fail';
|
|---|