Small php program to email from a form. Not tested, but should work, let me know if there's any errors, and I'll fix it. Also, this DOES NOT stop bots from filling out the form and pressing submit to send you spam, but there's no way they can get your email address since it's server side. Anyways, just name it something like "emailus.php", style it or whatever, improve it, upload and throw a link to it on your site, and you're done.
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Contact me!</title>
</head>
<body>
Send me an email<br><br>
<form method="post" action='./'>
Source Email: <input type="text" name="sourceemail"><br><br>
Subject: <input type="text" name="subject"><br><br>
Message Body:<br>
<textarea name="message" cols="40" rows="5">Default message here...</textarea><br><br>
<input type="submit" name="send" value="Go">
</form>
<?php
//If go button is pressed...
if(isset($_POST['send'])) {
$sourceemail = $_POST['sourceemail'];
$destinationemail = 'your-destination-email-here@domain.com'
$message = $_POST['message'];
$subject = $_POST['subject'];
if(($sourceemail && $message && $subject) != '') {
mail($destinationemail, $subject, $message, $sourceemail);
echo '<br><b>Email has been sent.</b>';
}
else {
echo '<br><font color="#ff0000"><b>FILL OUT ALL THE FIELDS</b></font>';
}
}
?>
</body>
</html>
Now, personally, what did I do? I used a mailto, BUT, with one defining difference. It's soo secret, I can't mention it in public, I sent you a PM, only share with trusted people, can't have this getting out, that's when bots start being made to recognize it.
Bookmarks