use Net::Cmd; use Net::SMTP; my $smtp = Net::SMTP->new($mailserver) || die $!; #print p("Couldn't create the smtp object"); $smtp->auth($username, $password) or die "Can't authenticate: $!\n";