From: Fúlvio <fulvi...@gmail.com>
> Hi all,
>
> I am trying to send an email using the following code:
>
> use Net::SMTP;
>
> $smtp = Net::SMTP->new("smtp.yahoo.com");
> $smtp->mail('fulviocg');
>
> but the error below is happening:
>
> Can't call method "mail" on an undefined value at ....

Apparently the Net::SMTP->new() failed to create the object. Most
likely it was unable to connect to smtp.yahoo.com. Find out how to
ask Net::SMTP what's wrong with creating the object and do test
whether you obtained one or not.

Actually ... it looks like you'd have to dive way below the surface
to find out how the heck to get any error information from Net::SMTP.
According to Net::Cmd's docs you may get some info by $smtp-
>message(), ->code(), ->ok() and ->status(), but the constructor
seems to give you zero information. Unless you enable debugging and
somehow catch whatever the module (or some of it's superclasses)
prints to STDERR.

You might have better luck with a different module. Mail::Sender or
MIME::Lite or Mail::Sendmail come to mind.

Jenda

===== je...@krynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to