Liza Das wrote:
> Hi Bill,
>
> I tried what you sent me and get the following:
> Can't call method "mail" on an undefined value at test.pl line 24.
>
> When I try the following, it runs but I still don't get any emails:
>
> #!/usr/bin/perl -w
>
> use strict; # not Strict
> use warnings;
> use Socket;
> use Net::SMTP;
>
> #sendmail ('[EMAIL PROTECTED]', '[EMAIL PROTECTED]', "test\n");
> #exit;
>
> #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Where do you call sendmail ?
> sub sendmail {
> #my $from = shift;
> #my $to = shift;
> #my $msg = shift;
>
> my $from = '[EMAIL PROTECTED]';
> my $to = '[EMAIL PROTECTED]';
> my $msg = "test\n";
>
> my $smtpserver = 'mail.corp.idt.net'; # do you have a fully qualified name
> like:
> # mail.idt.net ???
>
> my $smtp = Net::SMTP-> new($smtpserver, Timeout => 10, Debug => 1);
> # check debug output for failure indication, then remove Debug arg
Try adding error check :
my $smtp = Net::SMTP->new($smtpserver, Timeout => 10, Debug => 1) or
die "new Net:SMTP: $! ($^)";
and see what it prints out.
> $smtp->mail($from);
> $smtp->to($to);
> $smtp->data();
> $smtp->datasend("From: $from\n");
> $smtp->datasend("To: $to\n");
> $smtp->datasend("Subject: Test SMTP\n");
> $smtp->datasend("\n");
> $smtp->datasend($msg);
> $smtp->dataend();
> $smtp->quit;
>
> };
>
> Thanks
> Liza
>
--
,-/- __ _ _ $Bill Luebkert Mailto:[EMAIL PROTECTED]
(_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED]
/ ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_ http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs