Net::SMTP problem



have a simple few lines of Perl I'm trying to run from a cgi program
to send some email.

My code looks like:
use Net::SMTP;
my $email="mda\@x.com";
my $msg="hello tst\n";
$smtp = Net::SMTP->new('smtp.x.com');# or die "Unable to open
the connection";
$smtp->mail('...@xxxxxxxxx');
$smtp->to($email);
$smtp->data($msg);
$smtp->dataend();
$smtp->quit;


When I run the code via command line it works. When I run it via a cgi
program from a webpage I get when it dies on the SMTP->new line:
Can't call method "mail" on an undefined value


Everything I"ve searched for says it is because my script cannot
contact the smtp server, but that's not the case because when I run it
via the command line, it works fine.


It looks like it has to be some permisssion thing, either in sendmail
or apache.


Any thoughts?


Thanks

.



Relevant Pages

  • Re: input <>; not working?
    ... You cannot read keyboard input from a CGI program launched by a web ... Standard input for a CGI program might contain a POST request, ... Try running your perl program from a command line prompt. ...
    (comp.lang.perl.misc)
  • Net::SCP::Expect issue
    ... One is a command line program that I ... run as root and the other is a cgi program through the browser. ... I tried to 'su apache' to see if I could scp from the command line as apache ...
    (comp.lang.perl.misc)
  • Re: Get Clients Windows Logon ID
    ... then they able to access my perl program. ... list of authorized windows user name is store in database, ... cgi program will auto login the user. ... If you execute this command ...
    (perl.beginners)
  • Re: system() behavior
    ... the systemcommand does not _produce_ any output. ... CGI program, then you may want to investigate why. ... You will have to silence whatever external command you ... perl program until the external command has returned. ...
    (comp.lang.perl.misc)
  • Weird Apache/Sendmail problem
    ... I have a simple few lines of Perl I'm trying to run from a cgi program ... When I run the code via command line it works. ... or apache. ...
    (comp.infosystems.www.servers.unix)