Hi,
My website has a "Email Me" button that I'm not yet sure of the behavior of. Either it will point straight to a "mailto:", or it will go to a form (that the HTML will specify a target address for).
In either case, what would be the safest way to add a target email address so that robots don't automatically pick it up and add it to their "spammable" lists?
There is no safe way to use a mailto: link. Either you use it and take your chances, or you don't use it and be assured that spambots are not able to find your email address.
When I say "don't use it" I mean use another method to send your emails, like server scripting which is totally safe from spambots.
Or - go to http://www.bebosoft.com/products/formstogo/overview/ and see if that looks promising.
You can do something like this on your page -
<?php echo $success?"<p>Your email has been sent!</p>":''; ?>
<?php echo $fail?"<p>There has been an error. Your email has not been sent!</p>":''; ?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" name="form1">
<label for="comments">Comments: </label>
<textarea name="comments" id="comments"></textarea>
<input type="submit" name="submit" value="submit">
</form>
Then at the top of the page put this (above the doctype) -
<?php
$success = false;
$fail = false;
if (array_key_exists('submit', $_POST) {
$to = 'you@example.com';
$subject = 'The email subject line';
$message = $_POST['comments'];
$headers ="FROM: admin@example.com\r\n";
$success = mail ($to, $subject, $message, $headers);
$fail = !$success;
}
?>
Message was edited by: Murray *ACP*
First contact your web host and ask them if they have a form-to-email script you can use. Hosts often provide scripts on their servers which you can activate through your Admin Panel or by referencing the script in your form's action attribute.
<form action="path-to-form-on-server/form-to-email-script.php">
Ideally, you want a form-to-email processing script that:
a) validates form input fields,
b) blocks hackers,
c) stops submissions from spam bots,
d) hides your email address from harvesters.
Formm@iler.php from DB Masters script does all of this and it's free if you credit the author; $20 per domain if you don't.
Related Links:
FormToEmail.com (free & pro versions available)
http://formtoemail.com/formtoemail_pro_version.php
Tectite
http://www.tectite.com/formmailpage.php
Nancy O.
So called e-mail address obfuscation methods are not 100% reliable. If JS is disabled, they don't work. Also, mailto: links require the end user to have e-mail software installed on their device. Owing to the increased popularity and accessibility of free web mail services like G-mail, Hotmail, Yahoo mail, etc... most people don't need e-mail software anymore. Without software, clicking a mailto: link does absolutely nothing.
For best results, use a contact form with a server-side e-mail processing script.
Nancy O.
North America
Europe, Middle East and Africa
Asia Pacific