Loading ...
Sorry, an error occurred while loading the content.

RE: [PBML] having problems with form mail for unix

Expand Messages
  • Adrian Stovall
    sure, plenty. what does the script look like? (and for that matter, what is it not doing) ... From: thomas bernard [mailto:speyearts@yahoo.com] Sent: Monday,
    Message 1 of 4 , Aug 6, 2001
    • 0 Attachment
      sure, plenty. what does the script look like? (and for that matter, what
      is it not doing)

      -----Original Message-----
      From: thomas bernard [mailto:speyearts@...]
      Sent: Monday, August 06, 2001 12:43 PM
      To: perl-beginner@yahoogroups.com
      Subject: [PBML] having problems with form mail for unix


      I'm having problems getting a form mail script I wrote
      to work for a unix based server. Suggestions?


      __________________________________________________
      Do You Yahoo!?
      Make international calls for as low as $.04/minute with Yahoo! Messenger
      http://phonecard.yahoo.com/




      Your use of Yahoo! Groups is subject to
      http://docs.yahoo.com/info/terms/
    • thomas bernard
      It wasn t working at all when I tested it. It s just giving me a server 500 error. I did chmod 755 on it already. #!/usr/bin/perl &parsedata; &sendemail;
      Message 2 of 4 , Aug 6, 2001
      • 0 Attachment
        It wasn't working at all when I tested it. It's just
        giving me a server 500 error. I did chmod 755 on it
        already.
        #!/usr/bin/perl
        &parsedata;
        &sendemail;
        &printthanks;
        sub parsedata
        {
        read(STDIN, $in, $ENV{'CONTENT_LENGTH'});
        @in = split(/&/, $in);

        foreach $i (0 .. $#in)
        {
        $in[$i] =~ s/\+/ /g;
        $in[$i] =~ s/%(..)/pack("c",hex($1))/ge;
        ($key, $val) = split(/=/,$in[$i],2);
        $in{$key} .= '\0' if (defined($in{$key}));
        $in{$key} .= $val;
        }
        }
        {
        open (SENDMAIL, "| /usr/bin/sendmail -t -n");
        print SENDMAIL <<EOM


        To:
        From:
        Reply-to:
        Subject: Email from the mail form
        fullname = $in{'full_name'}

        EOM

        }
        sub printthanks
        {

        print "Content-type: text/html \n\n";
        print <<"EOM";

        <html>
        <head>
        <title>Thanks for Submitting the Form</title>
        </head>
        <body bgcolor="#ffffff">
        <h2>Thank you for answering our form</h2>
        You should receive a response shortly.
        </body>
        </html>
        EOM

        print "";

        }


        The sole reason I wrote the script above was because I
        couldn't get the script below to work?


        #!/usr/bin/perl

        require "../subparseform.lib/subparseform.lib";
        &Parse_Form;
        print "Content-type:text/html\n\n";

        $to = $formdata{'to'};
        $from = $formdata{'from'};

        $subject = $formdata{'subject'};
        $contents = $formdata{'contents'};

        open (MAIL, "|/usr/lib/sendmail -t") || &ErrorMessage;

        print MAIL "To: $to \nFrom: $from\n";
        print MAIL "Subject: $subject\n";
        print MAIL "$contents\n";

        close (MAIL);

        print "Thanks for your comments.";

        sub ErrorMessage {
        print "<P>The server has a problem. Aborting
        script. \n";
        exit;
        }

        I was hoping to make the first script work by not
        having to require the subparseform.lib....Now if I can
        get either script to work I will feel happy. I'm still
        new at this but am trying. Any help would be great.



        __________________________________________________
        Do You Yahoo!?
        Make international calls for as low as $.04/minute with Yahoo! Messenger
        http://phonecard.yahoo.com/
      • Adrian Stovall
        well, if that s the actual script, you never named the sendemail subroutine...that could cause a problem. sub parsedata
        Message 3 of 4 , Aug 6, 2001
        • 0 Attachment
          well, if that's the actual script, you never named the "sendemail"
          subroutine...that could cause a problem.


          <snip>
          sub parsedata <---okay, fine
          {
          read(STDIN, $in, $ENV{'CONTENT_LENGTH'});
          @in = split(/&/, $in);

          foreach $i (0 .. $#in)
          {
          $in[$i] =~ s/\+/ /g;
          $in[$i] =~ s/%(..)/pack("c",hex($1))/ge;
          ($key, $val) = split(/=/,$in[$i],2);
          $in{$key} .= '\0' if (defined($in{$key}));
          $in{$key} .= $val;
          }
          } <------"sub sendemail" should come after this, I think
          {
          open (SENDMAIL, "| /usr/bin/sendmail -t -n");
          print SENDMAIL <<EOM


          To:
          From:
          Reply-to:
          Subject: Email from the mail form
          fullname = $in{'full_name'}

          EOM

          }

          </snip>
        • imacat
          ... From: thomas bernard ... Well, the output of STDERR (or say, error messages) will be written to error_log. Have you checked it?
          Message 4 of 4 , Aug 6, 2001
          • 0 Attachment
            ----- Original Message -----
            From: "thomas bernard" <speyearts@...>
            > It wasn't working at all when I tested it. It's just
            > giving me a server 500 error. I did chmod 755 on it
            > already.

            Well, the output of STDERR (or say, error messages) will be
            written to error_log. Have you checked it?


            Best regards,
            imacat ^_*'
            imacat@...
          Your message has been successfully submitted and would be delivered to recipients shortly.