Results 1 to 7 of 7
  1. #1
    Join Date
    Aug 2002
    Location
    Tampa Bay, FL
    Posts
    27

    Help needed to convert perl scripts to work on windows box.

    I modified a couple of guestbook perl scripts a few years ago for a friends web site. He was hosted on a linux server then, and recently switched to a windows based host .
    I finally got some other scripts working, but a few email scripts don't do it. it was sendmail before, and now it is qmail running on separate server.

    I tried instead of /usr/bin/sendmail saying mail.mydomain.com. but it didn't work.
    I get this error "%1 is not a valid Win32 application."
    here is my code (at least the first part)


    PHP Code:
    #!/usr/bin/perl

    if ($ENV{'REQUEST_METHOD'eq 'POST') {

            
    # Get the input

        
    read(STDIN$buffer$ENV{'CONTENT_LENGTH'});

            
    # Split the name-value pairs

        
    @pairs split(/&/, $buffer);

            
    # Load the FORM variables

        
    foreach $pair (@pairs) {
            (
    $name$value) = split(/=/, $pair);
            
    $value =~ tr/+/ /;
            
    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C"hex($1))/eg;

            
    $FORM{$name} = $value;
        }

                    
        
    open (MESSAGE,"| mail.xx*********** -t");

            
    # Format email header information

        
    print MESSAGE "To: $FORM{submitaddress}\n";
        if (
    $FORM{emailne "") {
            print 
    MESSAGE "Reply-To: $FORM{email}\n";
        }

            
    # Write the actual email message

        
    print MESSAGE "Subject: Request to join available flight list from $FORM{name}\n\n";
        if (
    $FORM{emailne "") {
        print 
    MESSAGE "Email: $FORM{email}\n"; }
        if (
    $FORM{replyeq "yes") {
        print 
    MESSAGE "Please reply.\n\n"; }
        print 
    MESSAGE "$FORM{feedback}\n";
        
    close (MESSAGE);
            
    # Thank the user and acknowledge 
            # the feedback
        
    &thank_you;





  2. #2
    Join Date
    Apr 2001
    Location
    California
    Posts
    131
    Hi setherd,

    You're going to need to use a module like Net:MTP to send e-mails if you don't have sendmail. I found a couple of sendmail clones for windows but you need to have admin access to intstall them.

    Regards,
    Charlie

  3. #3
    Join Date
    Aug 2002
    Location
    Tampa Bay, FL
    Posts
    27
    OK thanks I have some reading to do.

    but is there an easier way to send an email form from a windows hosted site perhaps?

  4. #4
    Another option is to load blat on your win box. From the Readme :

    Blat is a Public Domain Windows 95/NT console utility that sends the contents of a file in an e-mail message using the SMTP protocol. Blat is useful for creating scripts where mail has to be sent automatically (CGI, backups, etc.), or just as a quick way to send a file or message quickly from the command line. It will store relevant configuration details in the registry for ease of use. Optionally, blat can also attach multiple binary files to your message.

    http://www.interlog.com/~tcharron/blat.html

  5. #5
    Join Date
    Aug 2002
    Location
    Tampa Bay, FL
    Posts
    27
    thanks for the replys.

    actually I ended up moving him to a freebsd server, the perl scripts wouldn't work so I hacked together some new ones in PHP.....all in all it was a PITA

  6. #6
    Join Date
    Nov 2002
    Posts
    1
    Your script has two security holes and I only skim read it

  7. #7
    Join Date
    Aug 2002
    Location
    Tampa Bay, FL
    Posts
    27
    Originally posted by immediately
    Your script has two security holes and I only skim read it
    Really?!

    could you explain a little more?
    I won't claim to be able to script much at all, I just find a similar script to what I need and hack something together.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •