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

Hi, I am pretty new to perl and need some help. I have downloaded an example of sending a Form Data via email. I try to run it but after filling a Form when I click submit button that sends the data to the specified email.

Instead of sending the data after processing the perl file my browsers opens a dialog box asking me if I want to save the Perl file or open it. I don't want this to happen. When I click submit the data is processed by the Perl file and then emailed to specified email address.

I am connected to the Internet and have windows 2000 I also have IIS server installed. So why it's not sending the data through email. I tried the program with ASP and it works. But I need to make it work with CGI/PERL. Is there any settings I have to make I have Perl5.0 installed on my computer.

Please help me solve this problem as I am new to Pearl and trying to learn it.

Thanks for any help.

Replies are listed 'Best First'.
•Re: Problem in sending Form data via email
by merlyn (Sage) on Jul 05, 2002 at 21:14 UTC
Re: Problem in sending Form data via email
by Speedy (Monk) on Jul 06, 2002 at 00:36 UTC

    Merlyn's example is great, except that it uses the UNIX-based "sendmail" as the email-sending mechanism, and you specified you are on a Windows 2000 system using Microsoft IIS.

    The "Mail::Sendmail" Perl module is good IIS substitute for UNIX sendmail -- because it is all Perl, works on Windows (as well as other platforms), and for Windows can be found precompiled using the ActiveState Perl Package Manager for their Windows version of Perl.

    Corion gives a good description of using Mail::Sendmail in the module reviews on this site.

    If needed, see the ActiveState description of PPM. With ppm on your Win 2000 server, finding the "Mail::Sendmail" module is as easy as typing (from the command line) ppm, then
    search Mail::Sendmail
    to ensure it is there, then if so:
    install Mail::Sendmail

    Speedy

    Live in the moment

Re: Problem in sending Form data via email
by George_Sherston (Vicar) on Jul 05, 2002 at 21:07 UTC
    I'd guess that this is a programme that needs to be installed on your server, rather than on your local machine, though without seeing the script it's hard to say. Where have you installed it? If locally, that's probably (at least one part of the) problem. If you'd post the first few lines of the script, someone might be able to tell you.

    Another possibility is that the directory where the file is located is not Perl-enabled. This is a problem of webserver configuration rather than Perl. Your ISP will tell you how to fix it - they will have a procedure for you to run CGI scripts (if they don't, you're *really* in trouble).

    One final thought is that if you got your programme from Matt's Script Archive, you'd do well to replace it with the much better version that does all the same things but without tears, from nms.

    § George Sherston
      I have installed the following program on my desktop and trying to run on a Dos prompt while online but doesn't send mail. Here is the code that I am trying to test.
      <CODE>
      #!/usr/bin/perl -w
      use Mail::Mailer;
      print "\nTo: ";
      $dest = <STDIN>;
      chomp $dest;
      print "Subject: ";
      $subj = <STDIN>;
      chomp $subj;
      print "\nBody:\n";
      $body = <STDIN>;
      $mailer = Mail::Mailer->new("smtp", Server=> "pop.prodigy.net");
      $mailer->open( { From => 'Mr Grits <xyz@prodigy.net>',
      To => "burn_hall@yahoo.com",
      Subject => "TESTING THE MAIL" } )
      or die "Could'nt do it: $!\n";
      print $mailer $body;
      $mailer->close();

      thanks for help
        change this part:
        $mailer = Mail::Mailer->new("smtp", Server=> "pop.prodigy.net");
        with this :
        $mailer = Mail::Mailer->new("smtp", Server=> "smtp.prodigy.net");
        I think this is the problem cheers!!!!