Helpful Information
 
 
Category: Perl/ CGI
FormMail question

My server uses formmail to mail me my form enquiries. I would like to put the recipient email address within the perl file instead of as a hidden field in the html file (to try and avoid harvesting etc).

Not only do I have no idea how to do this I also have no clue regarding perl either.

Providing that it is possible to do this, it would be great if somebody could give me the idiots guide to solving it or just post the code so that I could paste it into the .pl file. :thumbsup: There will only ever be one address to mail to. I am using ver 1.9 dated 8/3/01 on an NT server (if that makes any difference)

Any help on this would be fantastic.:D

well if you want to mess a bit with the script you can just look for a line which says,

print MAIL "to: somehitng";

or somehting similar, probly the something will be $FORM{to} not sure how the script was done, then just change the something to your e-mail address, and youll be done, just reupload the file in ascii mode and chmod it 755,

or else if you want i can post an already done scirpt that send all the info to your mail

Calilo

Thanks. I'll give that a go

To be more specific, find this section in the formmail script and adjust it as follows:-

sub send_mail {
# Localize variables used in this subroutine. #
local($print_config,$key,$sort_order,$sorted_field,$env_report);

# Open The Mail Program
open(MAIL,"|$mailprog -t");

##########################################
# print MAIL "To: $Config{'recipient'}\n"; # Disabled - recipient is hard coded #
##########################################

print MAIL "To: yourname\@yourdomain.com\n"; # Only this one valid recipient #


Don't forget to escape the @ sign with a \ backslash.


You can then alter the hidden field 'recipient' in your html form to a ficticious email address such as [email protected] Of course, the action of the form must submit to your cgi-bin as before.

or you could write it in with JavaScript, as harvesters cant read it...

<script>
name="bob";
domain="hotmail.com";
code='<input type="hidden" name="mailto" value="'+name+'@'+domain+'" \/>';
document.writeln(code)
</script>

sorry to talk about such things in a server side forum :eek:

Thats great, thanks a lot, don't quite know what I'm doing but I've done what you siad and it works a treat. Thanks guys :thumbsup:










privacy (GDPR)