#!/usr/bin/perl -w use strict; use Net::SMTP; use IO::Scalar; my $smtp; my $debug = ''; tie *STDERR, 'IO::Scalar', \$debug; $smtp = Net::SMTP->new('your.smtp.server', Hello => 'a.domain.it.accepts', Timeout => 30, Debug => 1, ); $smtp->quit(); untie *STDERR; print grep {/SIZE/} (split(/\n/,$debug));