For Programmers: Free Programming Magazines  


Home > Archive > PERL Miscellaneous > September 2006 > Net::SMTP module error









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 Net::SMTP module error
- Bob -

2006-09-28, 7:59 am

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


Brian Wakem

2006-09-28, 7:59 am

- Bob - wrote:

> 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



Your host does not have the module installed.


--
Brian Wakem
Email: http://homepage.ntlworld.com/b.wakem/myemail.png
- Bob -

2006-09-28, 7:59 am

On Thu, 28 Sep 2006 13:34:07 +0100, Brian Wakem <no@email.com> wrote:


>
>
>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 ?

Ralph Moritz

2006-09-28, 6:59 pm

- Bob - <uctraing@ultranet.com> writes:

> On Thu, 28 Sep 2006 13:34:07 +0100, Brian Wakem <no@email.com> wrote:
>
>
>
>
> 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

--
Ralph Moritz
Quantum Solutions Ph: +27 315 629 557
GPG Public Key: http://ralphm.info/public.gpg
Ted Zlatanov

2006-09-28, 6:59 pm

On 28 Sep 2006, uctraing@ultranet.com wrote:

> 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. Gleixner

2006-09-28, 6:59 pm

- Bob - wrote:

> 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"
Sponsored Links







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

Copyright 2008 codecomments.com