Stoney has asked for the wisdom of the Perl Monks concerning the following question:
it produces the error message:-#!/usr/bin/perl use CGI; use warnings; use strict; use CGI::Carp qw/fatalsToBrowser/; use Mail::SendEasy; my $query = new CGI; print $query->header(); print "it works";
So despite being told it’s there I don’t seem to be able to call it. My alternative method suggested in a reply to my previous post was to use code like this using /usr/sbin/sendmail :-Can't locate Mail/SendEasy.pm in @INC (@INC contains: d:/perl/site/lib + d:/perl/lib .) at d:\domains\....etc
But this produces the error as follows:-#!/usr/bin/perl use CGI; use warnings; use strict; use CGI::Carp qw/fatalsToBrowser/; my $query = new CGI; print $query->header(); my $mailprog ="/usr/sbin/sendmail"; my $mailflags ="-t -n -oi"; my $recipient = 'recipient@domain.com'; my $msg_goes_here = "you're message"; open SENDMAIL, "| $mailprog $mailflags" or warn $!; print SENDMAIL "From: user\@domain.com\n"; print SENDMAIL "To: $recipient\n"; print SENDMAIL "Subject: testing 123\n\n"; print SENDMAIL $msg_goes_here; close SENDMAIL;
Which is referring to the open SENDMAIL line and I can’t figure out what’s wrong with this… Next I tried this suggestion from a reply to my previous post which was to use Net::SMTP code like this:-Send_Details.pl: Bad file descriptor at d:\domains\mysite.co.uk\wwwroo +t\cgi-bin\Send_Details.pl line 20 …etc
But this produces the error as follows:-use CGI; use warnings; use strict; use CGI::Carp qw/fatalsToBrowser/; use Net::SMTP; my $query = new CGI; print $query->header(); my $smtp = Net::SMTP->new( Host => 'mailhost.from.com', Hello => 'thishost.from.com' ); $smtp->mail('from@from.com'); $smtp->to('to@to.com'); $smtp->data('this is the text of the message'); $smtp->quit;
If I move the ‘use Net::SMTP’ line around as below:-Can't load 'd:/perl/lib/auto/Socket/Socket.dll' for module Socket: loa +d_file:Access is denied at d:/perl/lib/XSLoader.pm line 64. at d:/perl/lib/Socket.pm line 412 Compilation failed in require at d:/perl/lib/Net/SMTP.pm line 13. BEGIN failed--compilation aborted at d:/perl/lib/Net/SMTP.pm line 13. Compilation failed in require at d:\domains\mysite.co.uk\wwwroot\cgi-b +in\Send_Details.pl line 10. BEGIN failed--compilation aborted at d:\domains\mysite.co.uk\wwwroot\c +gi-bin\Send_Details.pl line 10.
Then I get this error instead:-use CGI; use Net::SMTP; use warnings; use strict; use CGI::Carp qw/fatalsToBrowser/;
Which generally I know what the error means but don’t know what’s wrong in this case. Finally I tried this suggestion from a reply to my previous post which was to install the modules locally on the bit of the server I can affect. This was a new concept to me so I’m probably missing something obvious here. I copied the module Mail::Sendmail from CPAN, renamed the file calling it ‘Dispatch’ and put it in a directory directly under the cgi-bin called ‘Postal’ and in the file renamed it ‘package Postal::Dispatch;’ and then called as below:-CGI Error The specified CGI application misbehaved by not returning a complete s +et of HTTP headers.
And got the error:-#!/usr/bin/perl use CGI; use warnings; use strict; use CGI::Carp qw/fatalsToBrowser/; use Postal::Dispatch; my $query = new CGI; print $query->header(); print "it works";
If you’ve read this far thank you very much, I would really appreciate some pointing in the right direction here as it feels like I keep hitting objects that I can’t find the answer to how to get round them.Can't locate Postal/Dispatch.pm in @INC (@INC contains: d:/perl/site/l +ib d:/perl/lib .) at d:\domains\mysite.co.uk\wwwroot\cgi-bin\Send_Det +ails.pl line 11. BEGIN failed--compilation aborted at d:\domains\mysite.co.uk\wwwroot\c +gi-bin\Send_Details.pl line 11.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Difficulty in sending mail with Activestate Perl 5.10 on a windows server
by Herkum (Parson) on Feb 02, 2009 at 15:45 UTC | |
|
Re: Difficulty in sending mail with Activestate Perl 5.10 on a windows server
by weismat (Friar) on Feb 02, 2009 at 14:47 UTC | |
|
Re: Difficulty in sending mail with Activestate Perl 5.10 on a windows server
by kennethk (Abbot) on Feb 02, 2009 at 15:52 UTC | |
|
Resolved: Difficulty in sending mail with Activestate Perl 5.10 on a windows server
by Stoney (Novice) on Feb 02, 2009 at 17:15 UTC | |
by Anonymous Monk on Feb 03, 2009 at 08:41 UTC |