Net::SMTP module error

B

- Bob -

I ran into the following error when trying to run a program using
Net::smtp on a server at conversent.net. I think this is some sort of
a configuration error on their part but I don't know enough about Perl
and Unix to tell. I do know that the same program runs on other
similar servers without any problem.

I'd be interested in whether this is something I can hack a fix to
myself or if I am required to have the systems people correct it.

Thanks,

Error output and program snipit follow:

---------------------------------------------------------------------
Technical data v:: Can't locate Net/SMTP.pm in @INC (@INC contains:
/usr/perl5/5.6.1/lib/sun4-solaris-64int /usr/perl5/5.6.1/lib
/usr/perl5/site_perl/5.6.1/sun4-solaris-64int
/usr/perl5/site_perl/5.6.1 /usr/perl5/site_perl
/usr/perl5/vendor_perl/5.6.1/sun4-solaris-64int
/usr/perl5/vendor_perl/5.6.1 /usr/perl5/vendor_perl .) at
/webhome/s/mydomain.com/public_html/cgi-bin/myProgram.pl line 95.
BEGIN failed--compilation aborted at
/webhome/s/mydomain.com/public_html/cgi-bin/myprogram.pl line 95.

---------------------------------------------------------------------
#Program
---------------------------------------------------------------------
# start program
#!/usr/bin/perl -w
use strict;
use CGI qw:)all);
use CGI::Carp qw(fatalsToBrowser warningsToBrowser set_message);
# lots of code

sub send_email{

my($to, $from, $subject, $body)=@_;
use Net::SMTP;
my $relay="smtp.mydomain.net";
my $smtp = Net::SMTP->new($relay);
die "Could not open connection: $!" if (! defined $smtp);
$smtp->mail($from);
$smtp->to($to);
$smtp->data();
$smtp->datasend("To: $to\n");
$smtp->datasend("From: $from\n");
$smtp->datasend("Subject: $subject\n");
$smtp->datasend("\n");
$smtp->datasend("$body\n");
$smtp->dataend();
$smtp->quit;
}
# end program
 
B

Brian Wakem

- Bob - said:
I ran into the following error when trying to run a program using
Net::smtp on a server at conversent.net. I think this is some sort of
a configuration error on their part but I don't know enough about Perl
and Unix to tell. I do know that the same program runs on other
similar servers without any problem.

I'd be interested in whether this is something I can hack a fix to
myself or if I am required to have the systems people correct it.

Thanks,

Error output and program snipit follow:


Your host does not have the module installed.
 
B

- Bob -

Your host does not have the module installed.


Thanks... that's what I suspected. Is there anyway for me to
install/hack that module within my own area or do I have to have them
install no matter what ?

As a followup, is there alternative code that might do the same thing
without the Net::SMTP module ?
 
R

Ralph Moritz

- Bob - said:
Thanks... that's what I suspected. Is there anyway for me to
install/hack that module within my own area or do I have to have them
install no matter what ?

If @INC includes the current directory, you could simply install the
module into your program's directory.
As a followup, is there alternative code that might do the same thing
without the Net::SMTP module ?

Mail::Transport::SMTP might be an alternative.

P.S CPAN is your friend => search.cpan.org
 
T

Ted Zlatanov

As a followup, is there alternative code that might do the same thing
without the Net::SMTP module ?

Since you are not doing anything fancy, you could just open a
connection to the SMTP server on port 25 and print your message. You
have to escape lines that begin with a period, but otherwise it's
really not very complicated. That's what the Net::SMTP module does
internally, although it handles other ESMTP commands you won't need,
judging by your original code sample.

I would strongly recommend trying to install Net::SMTP instead,
though. Life's too short to reinvent the wheel!

Ted
 
J

J. Gleixner

- Bob - said:
Thanks... that's what I suspected. Is there anyway for me to
install/hack that module within my own area or do I have to have them
install no matter what ?

perldoc -q "How do I keep my own module/library directory"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top