Click to See Complete Forum and Search --> : hardcoding recipient email into script


bubba4gman
02-26-2007, 10:30 AM
Hey all. Any help with this is greatly appreciated!
I'm using a perl formmail script to send form results to my email. It gets my email address from a hidden input in the form, and compares my email and the domain I'm using with the @referers list in the script.
All I want to do is take the recipient email out of the form and have it specified in the script, to protect against spam bots. Anybody know how I can accomplish this?
Thanks again!

Jeff Mott
02-26-2007, 11:57 AM
It sounds like it's already protecting against bots. The referrers array is a list of allowed addresses to send to. If a spam bot tries to use an e-mail address not on that list, then it will (should) be rejected.

See also the sticky thread in this forum called "Finding CGI Scripts".

bubba4gman
02-26-2007, 12:17 PM
I understand that, but what I'm trying to do is protect my own email address. I have a hidden recipient input tag in my form to pass my email address to the script. I want to move that into the script to protect from having my own email address picked up by spammers. I don't get junk mail and I would prefer to keep it that way.
Thanks for the help!

GMan

aj_nsc
02-26-2007, 12:51 PM
Real easy to do. Just post the perl script and we'll tell you where to make the change(s)

bubba4gman
02-26-2007, 07:53 PM
Ok, here's my code. I had to put it into a text file and upload it to my server because it was too big to post here. Here's the link...
http://http://www.oakwoodbaptistcamphill.org/ofm.txt


Thanks!!!

GMan

aj_nsc
02-26-2007, 09:12 PM
Okay, this is really simple.

Just add this:


$Config{'recipient'} = "you\@yourmail.com";


(where you\@yourmail.com is the email address you want it sent to)

After this block of code:


$Config{'required'} =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
$Config{'required'} =~ s/(\s+)?\n+(\s+)?//g;
$Config{'env_report'} =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
$Config{'env_report'} =~ s/(\s+)?\n+(\s+)?//g;
$Config{'print_config'} =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
$Config{'print_config'} =~ s/(\s+)?\n+(\s+)?//g;


What this does is it sets the value of the <input name="recipient"... that you used to have in your form to a static value.

That should take care of everything. And also, if you want to send the form to more than one recipient then just add additional email addresses separated by commas.


$Config{'recipient'} = "you\@yourmail.com,me\@mymail.com,him\@hismail.com"


If you have any problems with this method, post them and we'll help you out.