On Thu, 16 Sep 2004, Anish Kumar K. wrote:
> This is the complete program
>
> use warnings;
> use strict;
> use Net::SMTP;
> my $ServerName = "*********.com";
> # Connect to the server
> my $smtp = Net::SMTP->new($ServerName);
> die "Couldn't connect to server" unless $smtp;
Ok, now that we've verified the SMTP server, let's reexamine this.
I'm able to do a command line test that emulates this but doesn't fail
for me:
$ perl -MNet::SMTP -le '$smtp = Net::SMTP->new("apu") or die "cannot connect to apu:
$!"; print $smtp'
Net::SMTP=GLOB(0x80b150)
$
So, I am able to connect to a random SMTP server on the local network
here; it would be interesting to see if you could do the same thing
using your server instead of "apu".
Also, the common idiom in Perl is to try something risky, then in the
same statement append a "... or die ...", rather than follow up as
you're doing here. Therefore, something like this:
my $smtp = net::SMTP->new( $ServerName )
or die "Couldn't connect to server: $!";
Note also that this should give the error message in $!.
Try that and see if it gets you anywhere further along.
--
Chris Devers
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>