Link to home
Start Free TrialLog in
Avatar of Dan_JB
Dan_JB

asked on

How to hide email addresses used with FormMail Pearl script and HTML form OPTION values

I have created an HTML form to work with the free FormMail 1.92 Pearl script (see http://www.scriptarchive.com/formmail.html). I want to send an email to the appropriate contact depending on the visitor's choice from a combo box, but I want to do this without allowing spam search engines any way to see the email addresses. I'm guessing there is a way to do this with Javascript and there may be other better ways such as customizing the Pearl script FormMail. I'm looking for code to do this easily and effectively! Thanks.
Avatar of cb1393
cb1393
Flag of United States of America image

If the email address is contained in code that is processed on the server side, I'm not sure that it would be viewable by bots unless you have it displayed on the page somewhere.
Avatar of Dan_JB
Dan_JB

ASKER

To do that I would need to customize formmail.pl which is certainly a possiblity if I know what to change.

Currently I'm just using a simple HTML form with code like this (which I presume would be viewable by bots as it is just in the HTML code):

<SELECT NAME="recipient">
      <OPTION VALUE="0" selected>-Select-</OPTION>
      <OPTION VALUE="employee1@domain.com">Customer Service</OPTION>
      <OPTION VALUE="employee2@domain.com">Sales</OPTION>
      <OPTION VALUE="employee3@domain.com">Careers</OPTION>
</SELECT>

The value of recipient determines who the form is sent to. This is actually an array passed to formmail.pl.

Dan
ASKER CERTIFIED SOLUTION
Avatar of COBOLdinosaur
COBOLdinosaur
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Dan_JB

ASKER

I have modified the check_required subroutine to include the following lines at the beginning (I did not use '_' as this could theoretically be a valid character in an address):

$Config{'recipient'} =~ tr/+?/@./;   # converts all zemployee1+domain?com to zemployee1@domain.com
$Config{'recipient'} =~ s/^.//;        # removes first character resulting in employee1@domain.com
$Config{'recipient'} =~ s/,z/,/g;      # if more than one email was submitted remove other 'z' prefixes

There might be a cleaner way to do this, but this works! Any suggestions to clean-up COBOLdinosaur? recipient is a comma delimited text string (as submitted from the form field).

Thanks,
Dan
That looks efficient, and as you said it works. :^)

Cd&