Hello, I have recently finished my first perl script, which processes a form, returns an html thank you page to the submitter, sends them a confirmation email, sends the company (whose website the form is for) an email and appends the contents of the form to a text file.
I used my UNIX account as I put the script together (easy to debug) and it works perfectly from there. Where it is supposed to go, however, is on a Windows NT server, so I've moved it there to try. The html page is returned perfectly (suggesting to the submitter that all is well, thank you) but no emails get sent and (as far as I can tell) no text file gets created (in my original, the text file created itself right in the cgi-bin -- as I could access it fine, I left it there). I am pasting an abbreviated version of the script below (nothing vital to its working is deleted). I have heard from the system administrator that where I originally used sendmail, I will need to use SMPT, so I have substituted SMPT where I had the sendmail reference. It didn't make any difference. Is it just a question of some directory structures that I don't know (I haven't been able to reach the system administrator yesterday or today) or is there something major that I have to change here? Many thanks in advance for any help. Rohesia Hamilton Metcalfe Here's the script: #!/usr/local/bin/perl use CGI qw(:standard); # import shortcuts use Fcntl qw(:flock); # imports LOCK_EX, LOCK_SH, LOCK_NB # The basic info from the form submission: $FirstName = param('FirstName'); $LastName = param('LastName'); $OtherFields = param('OtherFields'); $Email = param('Email'); # Putting all this information into one long string for input into text file: $EndRecord = "\n"; @AllData = ($LastName, $FirstName, $OtherFields, $Email, $EndRecord); $AllData = join (":", @AllData); # Setting up to send an email to the person who submitted the form with a cc to x-person $emailProgram = "| /usr/sbin/sendmail -oi -t"; $emailRecipient = $Email; $emailAdmin = "x-person\@x-company.com"; # cc to [EMAIL PROTECTED] $emailSender = "x-person\@x-company.com"; $emailSubject = "X-Company Submission Info - PLEASE KEEP"; # Creating a message based on the information in the fields. $message = "Dear $FirstName $LastName,\n\n Thank you for the information you have just submitted.\n\n The information you submitted is as follows:\n First Name: $FirstName\n Family Name: $LastName\n Other Fields: $OtherFields\n E-mail: $Email\n **********************************\n\n x-OtherText\n"; # Sending the email: $errmsg = &SendMessage ( 'to' => $emailRecipient, 'cc' => $emailAdmin, 'from' => $emailSender, 'subject' => $emailSubject, 'message' => $message, ); # Sending an html response back to whoever filled out the form: if ($errmsg eq 'sent') { print <<STOP_PRINT; Content-type: text/html <html> <head> <title>Thank You!</title> </head> <body bgcolor="#ffffff" text="#000000"> <p><font size="+1"> Thank you <B>$FirstName $LastName.</B></p> <P><B>x-Text.<BR><BR> In the meantime, here is a listing of the information you submitted. </p> <p> First Name: <B>$FirstName</B><BR> Family Name: <B>$LastName</B><BR> Other Fields: <B>$OtherFields</B><BR> E-mail: <B>$Email</B><BR> </P> <P>***************</P> <p> x-OtherText</P> </Body> </html> STOP_PRINT } else { print <<STOP_PRINT; Content-type: text/html <html> <head> <title>Error!</title> </head> <body bgcolor="#ffffff" text="#000000"> <p><font size="+1" color="#0000ff"> I encountered an error trying to process your submission: $errmsg </font></p> </body> </html> STOP_PRINT } # Sending the info to textfile, "x-filename.txt" DataEntry(); # --------------------------------------------------------------------------- # A routine to handle interaction with sendmail. sub SendMessage { my (%args) = @_; if (not $args{from}) { return "No 'from' header."; } if (not $args{to}) { return "Please go back and enter your email address"; } if (not $args{subject}) { return "No 'subject' header."; } if (open SENDMAIL, $emailProgram) { print SENDMAIL "From: $args{from}\n"; if ($args{'reply-to'}) { print SENDMAIL "Reply-to: ", $args{'reply-to'}, "\n"; } print SENDMAIL "To: $args{to}\n"; if ($args{cc}) { print SENDMAIL "Cc: $args{cc}\n"; } print SENDMAIL "Subject: $args{subject}\n"; print SENDMAIL "\n"; print SENDMAIL $args{message}; print SENDMAIL "\n"; close SENDMAIL; return "sent"; } else { return "Can't launch sendmail."; } } # a routine to output the submitted data to a file sub DataEntry { open (X-FILE, ">>x-filename.txt") || die "can't open x-filename.txt: $! "; flock (X-FILE, LOCK_EX) || bail ("cannot flock x-filename.txt: $!"); print X-FILE $AllData; close (X-FILE) || die "couldn't close x-filename.txt: $!"; } __________________________________________________ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]