Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
May 16, 2012, 05:59:32 PM

Pages: 1 2 [3]   Go Down
  Print  
Author Topic: FormMail.pl - Bad Gateway????  (Read 13714 times)
Comet Software
Spacescooter Operator
*****
Offline Offline

Posts: 34


« Reply #30 on: October 08, 2006, 07:43:01 PM »

the part you quoted is referring to cPanel on the linux plans, not plesk which is on the windows plans... which is why it looks different and is a bit confusing to follow in relation to the tutorial Smile

That's odd, cus I have a Windows plan.

OK, I reread this and i think I follow now.  The tutorial tells how to set this up via cPanel which is an app for Linux servers.  And, since I have a Windows plan, I have Plesk.  But, as i recall, the tutorial makes reference to some differences between Linux and Windows hosting, but, doesn't mention Plesk.

I guess a place to restart now would be to ask the question:  do I have to set permissions for the file if I have Windows hosting?  If so, how do I do that?
Logged
Comet Software
Spacescooter Operator
*****
Offline Offline

Posts: 34


« Reply #31 on: October 09, 2006, 04:30:28 PM »

OK, my domain has finally transferred, so, I can test this for real now.

When I click on my form's "submit" button, I get a web page that says:

502 Bad Gateway
Web server received an invalid response while acting as a gateway or proxy server.
Web Server at cometsoftware.com

The "Address" box in my browser has:

http://www.cometsoftware.com/cgi-bin/x123.pl


I have gone back and read over this thread and the "Can't quite figure out FormMail", and, I still can't get it to work (and, I'm not sure how this thread originator resolved his error).  So, let me review what I have and what I have done.


I am a new domain at Lunarpages on a Windows server.  My script is named "x123.pl" and was transferred via FTP "ASCII" to my domain's "cgi-bin" folder.  Perl is enabled for my domain.  These lines are in the configuration portion of the script:

shebang = #!C:/perl/bin/perl.exe
$mailprog = 'SMTP:cometsoftware.com';


These lines are in my html file:

<form name="contact_us" id="contact_us" method="post" action="/cgi-bin/x123.pl">
<input type="hidden" name="subject" value="Contact Us" />
<input type="hidden" name="required" value="realname,email,yourcomment" />
<input type="hidden" name="redirect" value="contact_us_success.htm" />


All of the "help" I have found for setting file permissions in Plesk seem to be referring to an older version than the one I am using.  So, I don't know what the script's permissions are, or are supposed to be, for the "Group or user names" panel.

I don't know where to go from here   Help
Logged
Comet Software
Spacescooter Operator
*****
Offline Offline

Posts: 34


« Reply #32 on: October 16, 2006, 03:41:51 PM »

OK, i guess FormMail doesn't work on LP Windows hosting.

Anybody have suggestions for an alternative?
 
Logged
craverii
Newbie
*
Offline Offline

Posts: 1


WWW
« Reply #33 on: October 29, 2006, 07:37:22 PM »

I really believe that the best way to handle form mailing is by creating your own simple mail client in perl, bypassing sendmail altogether.  Below is a sample script.  values inside of
braces ([...]) are meant to be replaced with your specific values.

----BEGIN CODE----
#!/usr/bin/perl

use strict;
use CGI::Carp qw(fatalsToBrowser);
use CGI qw/:cgi-lib -no_xhtml/;
use Mail::Mailer;

### User definable variables
my $mailhost = 'localhost';
my $mail_recipient = '[your_email@yourdomain]';
my $subject = '[Your Subject Line]';
###

my $cgi = new CGI;
send_email();

# This redirects clients to a prefabricated page upon completion, but
# it could just as easily be made to generate HTML output as a result.
redirect_client();

sub send_email {
    # All of the form variables are in the hash %form_vars.  Each form control name
    # is a key in the hash, e.g. $$form_vars{'email'}, 'email' being the form control name.
    my $form_vars = Vars;
    my $mailer = Mail::Mailer->new();
    $mailer->open({ From    => $$form_vars{'email'},
                    To      => $mail_recipient,
                    Subject => $subject,
                  })
        or die "Can't open: $!\n";
    print $mailer $$form_vars{'comments'};
    $mailer->close();
}

sub redirect_client {
    print $cgi->redirect('http://[yourdomain]/thankyou.html');
}

exit 0;
----END CODE----

Regards,

Rob
Logged
webgeeko
Newbie
*
Offline Offline

Posts: 1


« Reply #34 on: October 04, 2009, 02:52:21 AM »

Smile okay great, hope there's an answer.

Just for the heck of it though, I found one more possible way to write the shebang line for a Windows server, so replace the very first/top line of the script to:

Code:
#!C:/perl/bin/perl.exe

I'm pretty sure that with the right shebang line and changing the $mailprog to your SMTP, that should do it  Smile. In the CONFIGURATION section, change the $mailprog to this:

Code:
$mailprog = 'SMTP:yourdomain.com';

Replace yourdomain.com with your domain name.

* Edited - Okay, I tested out the SMTP part on my server and that works (using the code I gave above for the $mailprog bypasses using sendmail), so the only thing that is needed is the path to perl for the script to work on Windows server.

Thank you soooooooooooooo much............. this works.  Applause
Logged
Pages: 1 2 [3]   Go Up
  Print  
 
Jump to: