Perl form mailer... ARGH

 
Post new topic   Reply to topic    Aprelium Forum Index -> Perl
View previous topic :: View next topic  
Author Message
biggersm
-


Joined: 28 Jan 2004
Posts: 5

PostPosted: Tue Jun 29, 2004 7:01 pm    Post subject: Perl form mailer... ARGH Reply with quote

Ok... This is killing me. I have been working on this forever and have tried so many different options..

All I want is for my web form to be emailed to me. I have read about needing a mail server..ArGoSoft, well, I have it and have no idea what to do with it...

I have definitely followed the abyss install instructions for Perl.

The setup/config that I have is,
my website + Abyss, + no-ip, ( I am also using the bebosoft forms-to-go) and a simple netgear firewall and router. I do not have mail service through noip, but have been trying to use my local @hotmail and @erau.edu addresses.

After testing the form with no validation, it tells me success, but I never recieve any emails.

here is my html code sample,

<form action="formpagedda.pl" method="post" enctype="application/x-www-form-urlencoded">
<strong>
<p>Parents First Name: &nbsp;<input type="text" name="pfname" id="pfname" size="20" maxlength="30">
&nbsp;Parents Last Name: &nbsp; <input type="text" name="plname" id="plname" size="20" maxlength="30"></p>
<p>First Child's Name: &nbsp; <input type="text" name="cfname" id="cfname" size="20" maxlength="30">&nbsp; Age: <input type="radio" name="age" id="age" value="3-5">3-5 &nbsp; <input type="radio" name="age" id="age" value="6-9">6-9 &nbsp; <input type="radio" name="age" id="age" value="10-12">10-12&nbsp; <input type="radio" name="age" id="age" value="YoungAdult">Young Adult </p>
<p>Second Child's Name: &nbsp; <input type="text" name="c2fname" id="c2fname" size="20" maxlength="30">&nbsp; Age: <input type="radio" name="age" id="age" value="3-5">3-5 &nbsp; <input type="radio" name="age" id="age" value="6-9">6-9 &nbsp; <input type="radio" name="age" id="age" value="10-12">10-12&nbsp; <input type="radio" name="age" id="age" value="YoungAdult">Young Adult </p>
<p>Third Child's Name: &nbsp; <input type="text" name="c3fname" id="c3fname" size="20" maxlength="30">&nbsp; Age: <input type="radio" name="age" id="age" value="3-5">3-5 &nbsp; <input type="radio" name="age" id="age" value="6-9">6-9 &nbsp; <input type="radio" name="age" id="age" value="10-12">10-12&nbsp; <input type="radio" name="age" id="age" value="YoungAdult">Young Adult </p>
<p>Address 1: &nbsp; <input type="text" name="address1" id="address1" size="40" maxlength="50"></p>
<p>Address 2: &nbsp; <input type="text" name="address2" id="address2" size="40" maxlength="50"></p>
<p>City: &nbsp; <input type="text" name="city" id="city" size="20" maxlength="30">&nbsp; Zip Code: <input type="text" name="zip" id="zip" size="5" maxlength="9"> </p>
<p>Email: &nbsp;<input type="text" name="email" id="email" size="35" maxlength="60"> </p>
<p>Preferred Method of Contact: &nbsp;<input type="radio" name="contact" id="contact" value="email">
Email &nbsp;<input type="radio" name="contact" id="contact" value="regmail">Regular Mail</p>
<p>&nbsp;</p>
<tr>
<td colspan="50%"><table>
<tr><td><p><strong>Please feel free to ask us questions and comments and we will do our best to reply to them..</strong></p>
<textarea name="comandques" cols="25" rows="10" id="comandques"></textarea>
<input type="submit" name="submit" value="Submit">&nbsp; <input type="reset" name="Reset" value="Reset"></td></tr>
</table>
</tr>
</strong>
</form>


here is my perl script,

#!/perl/bin/perl.exe

$mailprog = '/usr/sbin/sendmail -t -i -froot@mail.db.erau.edu';

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);

foreach $pair (@pairs){
($name, $value) = split(/=/, $pair);

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

$FORM{$name} = $value;
}

$pfname = $FORM{'pfname'};
$plname = $FORM{'plname'};
$cfname = $FORM{'cfname'};
$age = $FORM{'age'};
$c2fname = $FORM{'c2fname'};
$c3fname = $FORM{'c3fname'};
$address1 = $FORM{'address1'};
$address2 = $FORM{'address2'};
$city = $FORM{'city'};
$zip = $FORM{'zip'};
$email = $FORM{'email'};
$contact = $FORM{'contact'};
$comandques = $FORM{'comandques'};
$Submit = $FORM{'Submit'};
$Reset = $FORM{'Reset'};


# Redirect user to FAIL page

if ($validationfailed == 1)
{


print "Location: error.html\n\n";
exit;

}

# Email Body

$body_form_email = "pfname: $pfname\n"
. "plname: $plname\n"
. "cfname: $cfname\n"
. "age: $age\n"
. "c2fname: $c2fname\n"
. "c3fname: $c3fname\n"
. "address1: $address1\n"
. "address2: $address2\n"
. "city: $city\n"
. "zip: $zip\n"
. "email: $email\n"
. "contact: $contact\n"
. "comandques: $comandques\n"
. "Submit: $Submit\n"
. "Reset: $Reset\n"
. "\n"
. "";

# Send the email to the form owner

open(MAIL,"|$mailprog");
print MAIL "To: myemailisreallyhere\@erau.edu <>\n";
print MAIL "From: $email\n";
print MAIL "Subject: \n\n";
print MAIL $body_form_email;
close(MAIL);
# Redirect user to OK page

print "Location: success.html\n\n";
exit;
# End of Perl script

The perl script is not in my cgi-bin, it is in my htdocs folder. I have tried both ways and have only gotten succes with it being in htdocs.

What the hell do I do now....

HELP BEFORE I HAVE A BREAK DOWN...

the site is www.danceatdayspring.com

thanks
Back to top View user's profile Send private message
iNaNimAtE
-


Joined: 05 Nov 2003
Posts: 2381
Location: Everywhere you're not.

PostPosted: Tue Jun 29, 2004 7:16 pm    Post subject: Re: Perl form mailer... ARGH Reply with quote

biggersm wrote:
$mailprog = '/usr/sbin/sendmail -t -i -froot@mail.db.erau.edu';

Sorry, but that won't work. You are 1) trying to use a UNIX Sendmail program on Windows, and 2) adding an argument that doesn't exist anyway.

You need to download a form-to-mail script that also allows you to use an SMTP server, or download a Windows-style sendmail like Blat. http://mycgiscripts.com/formmail-pro.html is the script I use with an SMTP server. However, you are going to need to set up an account with your mail server, and send mail to yourname@localhost, and receive it using POP3.

Also, if your ISP provides an SMTP server for you to use (check their website), you can use the one they provide you, along with the email address they give you.
_________________
Bienvenidos!
Back to top View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
Anonymoose
-


Joined: 09 Sep 2003
Posts: 2192

PostPosted: Tue Jun 29, 2004 7:17 pm    Post subject: Reply with quote

#!/perl/bin/perl.exe

$mailprog = '/usr/sbin/sendmail -t -i -froot@mail.db.erau.edu';

For a start.

You're telling it to send mailing using sendmail, a *nix/BSD etc program, but you appear to be running Windows since you've added the perl.exe line. You're not going to get far sending mail with a program that doesn't exist on your system, and if it existed would be for a different platform!

Change your mailprog for something like Blat and use it to send mail either through your ISP or sit down, read the Argosoft instructions and set it up.

Searching the forum wouldn't go amiss either...
Back to top View user's profile Send private message
biggersm
-


Joined: 28 Jan 2004
Posts: 5

PostPosted: Tue Jun 29, 2004 7:24 pm    Post subject: Reply with quote

Ok..

the -froot@mail comment was a suggestion from the support peoples at bebosoft..

i have tried it with and with out that command and it has made no difference.

no emails, same results page.

I am dowloading different script now....
Back to top View user's profile Send private message
iNaNimAtE
-


Joined: 05 Nov 2003
Posts: 2381
Location: Everywhere you're not.

PostPosted: Tue Jun 29, 2004 7:26 pm    Post subject: Reply with quote

No, you need to either get Blat or get a new script with SMTP support. Just removing that argument wont fix anything...
_________________
Bienvenidos!
Back to top View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
Truplaya3208112
-


Joined: 02 Jul 2004
Posts: 47

PostPosted: Tue Jul 06, 2004 4:27 am    Post subject: Reply with quote

I have the same issuse as biggersm. iNaNimAtE I have Pegasus Mail and Advanced SMTP server (I have two because I've been trying to figure out how the hell to setup the forms to email me). I have a SMTP and POP address through Gawab. My incomin is pop.gawab.com and SMTp is smtp.gawab.com my email address there is truplaya3208112@gawab.com. so what would I put for the send mail address? PLEASE HELP. TY TY TY TY VERY MUCH in ADVANCED!
_________________

We don't have many users. Please help us out and sign up and be active
http://tpcpro.no-ip.com
http://tpcpro.no-ip.com/forum
Back to top View user's profile Send private message
biggersm
-


Joined: 28 Jan 2004
Posts: 5

PostPosted: Tue Jul 06, 2004 1:42 pm    Post subject: Reply with quote

Let me tell you how I solved this problem...

I STOPPED USING PERL!!

I instead began using PHP scripts to get the job done! It took a fraction of the time and there are a ton more 'easy to understand' scripts available on the web.

Have a great day,

Mike
Back to top View user's profile Send private message
iNaNimAtE
-


Joined: 05 Nov 2003
Posts: 2381
Location: Everywhere you're not.

PostPosted: Mon Jul 12, 2004 3:32 am    Post subject: Reply with quote

Truplaya3208112, you need to use a Perl script that supports SMTP server. Which script are you using? If it is the same one as biggersm, it won't work. Try the script I recommended.

biggersm, it really depends on the script. Some Perl scripts can be configured right out of the box (like the one I got off of MyCGIScripts), and some are harder. The same goes for PHP. PHP scripts will still try to use the UNIX sendmail just as Perl scripts will. However, when it comes to readability, I do agree with you. The Perl syntax is screwed and illogical...
_________________
Bienvenidos!
Back to top View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
Stone-D
-


Joined: 09 Jan 2004
Posts: 90

PostPosted: Thu Jul 15, 2004 4:41 pm    Post subject: Reply with quote

Use FormMail 1.92 from Matt's Script Archive : http://www.scriptarchive.com/formmail.html. Scroll right down to the bottom of the page and grab the modified version that uses BLAT instead of sendmail.

Then download BLAT from http://www.blat.net/194/

Extract BLAT, read the readme, and install.
Extract FormMail, read the readme, and install.

While you've still got the .cgi open in a text editor, scroll down until you see this code :

Code:

    close MAIL;
    # If we're running under Windows, we actually send mail here...
       if ($SERVER_OS eq "WIN") {
         $WIN_TEMPFILE =~ s/\//\\/g;
         $mailprog =~ s/\//\\/g;
         $BLAT_ARGS = "$WIN_TEMPFILE -t $Config{'recipient'} -penguin ";
         if($Config{'email'} ne ""){$BLAT_ARGS .= "-f $Config{'email'} "};
 $BLAT_ARGS .= "-q";
         system "$mailprog $BLAT_ARGS";
         unlink $WIN_TEMPFILE;
       };


Change this line :

Code:

         $BLAT_ARGS = "$WIN_TEMPFILE -t $Config{'recipient'} -penguin ";


to this :

Code:

         $BLAT_ARGS = "$WIN_TEMPFILE -t $Config{'recipient'} -ss -serverSMTP localhost -penguin ";


Replace localhost with your SMTP server, ie, mail.blah.org

Done.

Sorry for the rush, my gf just called saying she's ill.
_________________
--
Look, no SIG!
Back to top View user's profile Send private message
soldierboy101st
-


Joined: 13 Apr 2005
Posts: 5

PostPosted: Wed Apr 13, 2005 4:13 pm    Post subject: Reply with quote

Download 'bnbform.cgi' from anywhere, internet, then follow their very accurate, and easily read instructions for installation. Then download QK Server (freeware SMTP server), install it, no configuration needed and walla! Yer done.
Back to top View user's profile Send private message Visit poster's website
cagozoe
-


Joined: 24 Apr 2005
Posts: 23

PostPosted: Wed Sep 14, 2005 2:08 am    Post subject: i have one that works Reply with quote

Hi

just wanted you to know I too suffered a long time but have found a script that will email back to my email address and the form does not need to contain your email address. it is in the cgi script so you don't get email spam.

see it at http://www.cvb.dns2go.com/gandm/email.html

if you want a copy email me at: from that form:
Back to top View user's profile Send private message Visit poster's website
Babu_111
-


Joined: 22 Sep 2006
Posts: 1

PostPosted: Fri Sep 22, 2006 3:14 am    Post subject: Reply with quote

www.google.com
Back to top View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> Perl All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group