For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > May 2007 > SMTP problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author SMTP problem
moonhk

2007-05-18, 9:58 pm

Below coding copy from perldoc.

When I below error prompted
Can't call method "domain" on an undefined value at domain.pl line 8.

#!/usr/bin/perl -w
use strict;
use warnings;
use Net::SMTP;
my $smtp;

$smtp = Net::SMTP->new("mailhost");
print $smtp->domain,"\n";
$smtp->quit;

My version is
#perl -version

This is perl, v5.6.0 built for aix

Paul Lalli

2007-05-18, 9:58 pm

On May 18, 5:14 am, moonhk <moon_ils...@yahoo.com.hk> wrote:
> Below coding copy from perldoc.
>
> When I below error prompted
> Can't call method "domain" on an undefined value at domain.pl line 8.
>
> #!/usr/bin/perl -w
> use strict;
> use warnings;
> use Net::SMTP;
> my $smtp;
>
> $smtp = Net::SMTP->new("mailhost");
> print $smtp->domain,"\n";
> $smtp->quit;
>
> My version is
> #perl -version
>
> This is perl, v5.6.0 built for aix


Here's a dumb question - do you actually have an SMTP server on your
domain that's named "mailhost"? If not, change that argument to be
whatever the name of your server is.

And check for errors:
my $smtp = NET::SMTP->new("my_smtp_server")
or die "Could not connect: $!";

Paul Lalli

moonhk

2007-05-20, 10:01 pm

On 5=A4=EB18=A4=E9, =A4U=A4=C86=AE=C955=A4=C0, Paul Lalli <mri...@gmail.com=
> wrote:
> On May 18, 5:14 am, moonhk <moon_ils...@yahoo.com.hk> wrote:
>
>
>
>
>
>
>
>
>
>
>
> Here's a dumb question - do you actually have an SMTP server on your
> domain that's named "mailhost"? If not, change that argument to be
> whatever the name of your server is.
>
> And check for errors:
> my $smtp =3D NET::SMTP->new("my_smtp_server")
> or die "Could not connect: $!";
>
> Paul Lalli- =C1=F4=C2=C3=B3Q=A4=DE=A5=CE=A4=E5=A6r -
>
> - =C5=E3=A5=DC=B3Q=A4=DE=A5=CE=A4=E5=A6r -


Your are correct. I need to check smtp server IP address.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com