Form processor help.

  • Thread starter milefile
  • 4 comments
  • 641 views
10,832
I trying to cnfigure a free form processor I'd like to use on a website. I've downloaded what looks like a decent one, but the cinfiguration instructions are either not thorough enough, or I just don't understand.

Here are my questions:

1. What are the differences between using $SMTP or $sendmail (advantages / disadvantages).

2. How can I tell what the path to sendmail on my server is?

3. Is there a PHP solution to form processing?

This is the part I'm trying to configure. Any help would be greatly appreciated:

Code:
## $sendto and $ccto is Where form submissions will be sent,         ##
## (REMEMBER THE \ BEFORE THE @ SIGN example: \@)                    ##
## $sendto = "sendto\@yourdomain.com";  CORRECT WAY!!!!              ## 
## $sendto = "sendto@yourdomain.com";  WILL NOT WORK!!!!             ## 


	$sendto = "milefile\@*******";   ## (REMEMBER THE \ BEFORE THE @ SIGN)##

	$ccto = "milefile2\@*******";        ## (REMEMBER THE \ BEFORE THE @ SIGN)##


## $mailprog  Is the path to sendmail or your SMTP server - on your server or web space ##
	$useLib = "smtp";


        $smtp = "smtp.************";


## to use @okurls to verify the url the form is submited by; set $setokurl to 1 and      ##
## set $setokurl to 0 if you do not want to use @okurls to verfiy form submission URL    ##

        $setokurl = "0";

        @okurls = ("http://www.yourdomain.com", "http://yourdomain.com", "34.344.344.344");
 
Arghhh... I have the same problem, and this thread has no replies! My Perl skill is close to nil, and everything I found when Googling this didn't work. Could someone post/link to a perl snippet that will send an email?
 
Milefile...

what exactly do you need help with my friend?

forget SMTP, use the servers sendmail program instead. ONLY your isp can tell you the path to the sendmail program so ask them but the command is likely to be

open (MAIL, "|/usr/sbin/sendmail -t")

but its not a standard thing they do differ from ISP to ISP. If you have a control panel with your ISP log on and view the help files. All you need is usually in there.

sending a cc:



$youremail = milefile\@yahoo.com;
$anotheremail = milefile2\@yahoo.com
$theiremail = $email; # from the email field in the form

print MAIL "To: $youremail\n";
print MAIL "From: $theiremail\n";
print MAIL "cc: $anotheremail\n";
print MAIL "Subject: Online Comments!\n";
print MAIL "$comments\n"; # from the comments field in your form


the back slash before the @ sign is an escape key that perl uses to distinguish certain letters and characters from the reserved ones used by the program. For instance, perl declares an array by using the @ sign. @domain creates an array called 'domain'. therefor when you type: sendto@yourdomain.com perl thinks you are trying to access an array called 'yourdomain'. How is it supposed to know what you want? You use the escape key '/'. Therefore everytime perl encouters an escape key it knows its dealing with user input and not program keywords.

$sendto = "sendto\@yourdomain.com"; CORRECT WAY!!!! ---yes.
$sendto = "sendto@yourdomain.com"; WILL NOT WORK!!!! --- tries to create an array called 'yourdomain' and append something undefined called 'com' to the array and tries something weird you 'sendto' and then tries to append all this confusion to a variable called $sendto.! no wonder it causes errors..

your last part creates an array of ok urls, this is an antispamming device, i think, but it seems to create an array of all the urls that contain your form. if the form is submitted from a url other than the ones specified the email wont be sent. So fill up your array with your urls then :


$n=0;
foreach $url (@okurl) {

if ($url = $ENV{'HTTP_REFERRER'})
{
send email...;
}
else
{
print "your spamming my system, fool"; # email doesnt get sent
}


$n++;
}


this creates a foreach loop. this is an itteration loop that with works well with arrays. its works its way through each member of the array and performs an if/else loof to see if the urls in the array match the url in the http referrer in perls environment variable list. This variable is set to the url of the page that reffered you to the form. If it matched, the email gets sent...if not...its down into the big black hole to the bad spammer...

hope this helps...

if you need any help, just ask...

TS
 
I wrote a generic form processor, and posted the code here

It cycles through all the fields in the form that called it, and puts a line into the e-mail message like this:

Form Field Name = What the user wrote.

You don't need to know the path to the sendmail function, because mail() is a built-in function in PHP.

If you need to know more about how it works, just ask. :)
 

Latest Posts

Back