Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

CGI::Carp and Mail::SendEasy do not work

by kazin_ (Initiate)
on Jun 12, 2014 at 15:41 UTC ( [id://1089712]=perlquestion: print w/replies, xml ) Need Help??

kazin_ has asked for the wisdom of the Perl Monks concerning the following question:

On an old computer I created a couple of simple webforms years ago with a Perl script that would take a few html form fields, run through a script, and send an email to my inbox. On my new computer with Windows 8.1 I have used the same files (copy/paste) but when I submit the web form I get an IIS error:

"The specified CGI application encountered an error and the server terminated the process."

I whittled down the script and it seems to get hung up on the Carp and SendEasy portions. Here is the script that works on my old XP computer but not 8.1:
use CGI; use CGI::Carp qw(carpout fatalsToBrowser); use Mail::SendEasy; print "Content-type: text/html\n\n"; print "Done"; my $cgi = new CGI; my $Reminder = $cgi->param('Reminder'); my $message =<<EOF; <html> <head> </head> <body> $Reminder </body> </html> EOF my $status = Mail::SendEasy::send( smtp => 'localhost' , user => 'user' , pass => 'password' , from => 'me@domain.com' , from_title => 'ME' , to => 'me@domain.com' , subject => "Reminder Message" , html => $message, msgid => "0101" , ) ; if (!$status) { Mail::SendEasy::error ;}


I've verified that perl is properly installed through IIS 8 using various test scripts.

Replies are listed 'Best First'.
Re: CGI::Carp and Mail::SendEasy do not work
by neilwatson (Priest) on Jun 12, 2014 at 16:08 UTC
    Do you have an smtp server running on 'localhost' and what do its logs show?

    <rant>Domain.com is not a reserved domain, indeed it is owned by a corporation. Always use example.com, which is reserved for this purpose.</rant>

    Neil Watson
    watson-wilson.ca

      Unfortunetly, Neil, the code itself isn't the issue. The code I presented is the format in which the form is filled. The fields for stmp points to my mail relay server, and my domain is pointing to my actual domain.

      I didn't think it would be a wise idea to shooting out sensitive information out on the internet.

      Again, it seems that the functionality of Carp and Mail::SendEasy doesn't seem to work within Perl combined with IIS8, yet I can present other scripting in Perl to function.

        I know it doesn't really help fix your problem but the script worked for me on Windows 8.1 and IIS 8 (Activestate Perl 5.16.1). I had to remove a space before EOF though.

        poj
Re: CGI::Carp and Mail::SendEasy do not work
by Anonymous Monk on Jun 12, 2014 at 19:14 UTC

    That error message sounds like it's hiding the real error from the Perl script. Can you run the Perl script from the command line, and can you look into the IIS logs for the actual STDERR from the Perl script?

      I ran the script directly through perl and found that it seem that I may be missing a lib file Mail/SendEasy.pm to associate Mail/SendEasy function in perl. Here's my error log.

      C:\inetpub\wwwroot\site\cgi-bin>perl test.pl Status: 500 Content-type: text/html <h1>Software error:</h1> <pre>Can't locate Mail/SendEasy.pm in @INC (@INC contains: C:/Perl/sit +e/lib C:/P erl/lib .) at crf2.pl line 8. BEGIN failed--compilation aborted at crf2.pl line 8. </pre> <p> For help, please send mail to this site's webmaster, giving this error + message and the time and date of the error. </p> [Thu Jun 12 12:24:56 2014] crf2.pl: Can't locate Mail/SendEasy.pm in @ +INC (@INC contains: C:/Perl/site/lib C:/Perl/lib .) at crf2.pl line 8. [Thu Jun 12 12:24:56 2014] crf2.pl: BEGIN failed--compilation aborted +at crf2.pl line 8.
      Any ideas what version of perl I should look into or another way to get the Mail/SendEasy.pm file?

        Most likely, you can install it from CPAN at Mail::SendEasy, using the cpan tool that comes with your Perl.

        You need to install the module from the CPAN then. On Unix you'd type 'cpan Mail::SendEasy'. No idea how you'd do that on Windows.
Re: CGI::Carp and Mail::SendEasy do not work
by Anonymous Monk on Jun 12, 2014 at 23:39 UTC
    Do you know what this means? "The specified CGI application encountered an error and the server terminated the process."

    It means look at the logs for the real error message

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1089712]
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2024-03-28 19:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found