Hi,
Thanks for the suggestion. We use something similar on our website.
We're currently looking at a option to put email addresses inside the config section of FormMail, thereby avoiding them being in the HTML form at all.
Welcome to the Tectite Forums! You can download and get support for our free PHP FormMail (form processor) and other free software.
I share the concern of other users about the risk of exposing email addresses to spammers. In the past, I have had to abandon a domain because of spam, and I am desparately avoiding to have to do so again.
One of the solutions I have adopted is to hide my email addresses with javascript. I use a standard bit of code to create a mailto tag (those who have javascript disabled will just have to phone me!). I will display it here for your convenience, but the point is that this script can be adapted and used in forms for formmail.
The normal script is like this:
<p>
Please contact me on
<SCRIPT type="text/javascript" language="javascript"><!--
Textaddress='.'+ 'com';//tld as first part of the email address
Textaddress=('tectite'+ Textaddress);//domain as second part of the email address
Textaddress=('Robinson'+ '@' + Textaddress);//user surname as third part of the email address
Textaddress=('Russell'+ '.' + Textaddress);//user (eg john) as third part of the email address
Textalternative='my email address';//insert what the mailto link should look like on screen
var Textonscreen;if(Textalternative!=''){ Textonscreen=Textalternative; } else { Textonscreen=Textaddress; }
Textsubject=escape('Enquiry about Formmail');//insert the desired email subject line
Texttitle='Send email';//insert the desired link tip text on mouse-over
Textstatus='Click here to send me an email';//insert the desired statusbar text
Textclass='MyStyle';//insert the name of the desired css class
Texttagid='number';//insert the ID of the mailto tag
document.write('<A href="mai'+ 'lto:' + Textaddress + '?subject=' + Textsubject + '" ' + 'title="' + Texttitle + '" ' + 'onMouseOver=' + '"status=\'' + Textstatus + '\';return true' + '" ' + 'onMouseOut=' + '"status=\'\';return true' + '" class="' + Textclass + '" ID="' + Texttagid + '">' + Textonscreen + '</' + 'A>')//shows the constructed tag on screen
//--></SCRIPT>
<NOSCRIPT>
[This email address is hidden by JavaScript; enable scripts in your browser to see and use it.]
</NOSCRIPT>
to make send enquiries.
</p>
In forms for formmail, a hidden field must be created to specify the recipient email address. The following code should produce the hidden field in such a way that spam robots will have great difficulty finding and constructing it:
<SCRIPT type="text/javascript" language="javascript"><!--
Textaddress ='.'+ 'com';//tld as first part of the email address
Textaddress =('tectite' + Textaddress);//domain as second part of the email address
Textaddress=('Robinson'+ '@' + Textaddress);//user surname as third part of the email address
Textaddress=('Russell'+ '.' + Textaddress);//user (eg john) as third part of the email address
document.write('<input type="hidden" name="recipients" value="' + Textaddress + '" />')
//--></SCRIPT>
This script can be inserted in the body of the form document, exactly where you would otherwise put the hidden field tag.
I hope this will be of help.
Perhaps this could also be a pointer for a future release.
Hi,
Thanks for the suggestion. We use something similar on our website.
We're currently looking at a option to put email addresses inside the config section of FormMail, thereby avoiding them being in the HTML form at all.
Russell Robinson - Author of Tectite FormMail and FormMailDecoder
http://www.tectite.com/
Hi,Originally Posted by russellr
Any idea, when this option will be available? Since I can't make the js from the prev post work. The hidden value is not passed to the form, and therefore getting no recipient error.
Hi,
A matter of days. Probably early next week.
Russell Robinson - Author of Tectite FormMail and FormMailDecoder
http://www.tectite.com/
Originally Posted by russellr
Great. Can't wait... very well done script. thanks a lot.
If you hard-code the tag, and then replace document.write in the example with alert, then you can compare if the result of the script is actualy exactly what you want it to be. The script works, but you might have made a mistake filling it in. Or, perhaps, you put it in the wrong location; it should not be between the header tags or in a js sourcefile, but in the html where you would normally put the hard-coded tag.
Originally Posted by ewel
yeah, but can't seem to make it work :-)
Textaddress ='.'+ 'com';//tld as first part of the email address
Textaddress =('arrowlimos' + Textaddress);//domain as second part of the email address
Textaddress=('test'+ '@' + Textaddress);//user surname as third part of the email address
Textaddress=(''+ '.' + Textaddress);//user (eg john) as third part of the email address
document.write('<input type="hidden" name="recipients" value="' + Textaddress + '" />')
is not working. where is my mistake?
The script caters for double user names, eg. 'john.doe'. If the user name is single, eg. 'john' or 'johndoe', then the fourth line of the script is not only superfluous but causes an error because it adds a dot before, eg. '.john' or '.johndoe'. Sorry for not commenting this into the script.
Your username is test, so you were using only three of the four lines that build the address, clearly because you have no need for the first name part. Just delete the fourth line, that is the line before document.write:
Once I am at it, I should perhaps also note that if your user name were to be 'john_doe', you would use all four lines, but you would have to replace the dot in the fourth line by an underscore, like this:Code:Textaddress=(''+ '.' + Textaddress);//user (eg john) as third part of the email address
Code:Textaddress=('john'+ '_' + Textaddress);//user (eg john) as third part of the email address
You were correct, it was so obvious, tired over here. Thank you so very much!Originally Posted by ewel
Originally Posted by russellr
Did anything ever come of this?
I'm using version 7.12 on my information site, scienceandyou.org in a slightly unusual role. It allows visitors to rate the essays, the result of which is then emailed to me.
(It works well by the way and thank you for making it available. I replaced the pl script from matt wright.)
Lately I was getting spam in the comment box, so I've just incorporated the js solution which works well. Now I'm wating to see if I've foiled the spammers.![]()
Anyhow, the solution you propose does have a certain appeal.
Best,
-Hank Mulder
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks