in reply to SMTP Authentication

The code you provided works as is for me using perl 5.8.4 and Net::SMTP 2.29 on a redhat enterprise 4 machine.

What operating system is this running on? Also what versions of perl and Net::SMTP?

Update - It's possible that you can't connect to that port, possibly because of a firewall or local permissions issue. For example, when running in a CGI script people using Fedora sometimes have a problem with SELINUX

Try this in the shell:

telnet smtp.1and1.com 25
If you can connect you should see this:
Trying 217.160.226.98... Connected to smtp.1and1.com. Escape character is '^]'. 220 smtp.perfora.net (mrelayus1) Welcome to Nemesis ESMTP server