• Quick note - the problem with Youtube videos not embedding on the forum appears to have been fixed, thanks to ZiprHead. If you do still see problems let me know.

Email link on website / hide from spambots

Bell

Penultimate Amazing
Joined
Sep 9, 2006
Messages
21,050
Allright, so a few months ago I created a PHP script thingy to allow for submitting a message to my email address through a website. I tested it back then, and it worked fine. The script was laying about for a while, and today I finaly decided to implemend it, but alas, it doesn't work. Seems like the host has added some restrictions regarding PHP usage. I think the script is (still) fine.

Code:
<?
$To =		"xxx xxxxxx <xxxx@xxxxxx.com>";
$Subject =	"xxx xxxxx xxxxx xxxxxxxxxx";

$Confirm =	"../contact2.html";

foreach ($_POST as $Field=>$Value)
$MessageBody .= "$Field: $Value\n";
$MessageBody = htmlspecialchars($MessageBody);

$From =		$_POST['NAME'];
$FromEmail =	$_POST['EMAIL'];

$Header =	"From: \"$From\" <$FromEmail>\r\n";

mail($To, $Subject, $MessageBody, $Header);

header("Location: $Confirm");
?>

So, for you php geeks ;) does the above script look okay?

Also, is there a way to create a 'mail to' html tag, without letting spambots collect the email address from the html source?


ETA: Riiight, so finally today's testmail arrived... some 4 hours after I had submitted it. The script works... but what the hell is up with the long delay??
 
Last edited:
Also, is there a way to create a 'mail to' html tag, without letting spambots collect the email address from the html source?

Do a google search for email address obfuscator. You'll find a bunch of solutions.
 
Also, is there a way to create a 'mail to' html tag, without letting spambots collect the email address from the html source?

This is the one situation where I prefer to use CGI over vanilla php. I store the email template in a .txt file and just use the form for the body, subject, and sender's email address.
 

Back
Top Bottom