Lyfa The Lonely Man
Reputation: 12 Joined: 02 Nov 2008 Posts: 743
|
Posted: Thu Jul 22, 2010 10:13 pm Post subject: |
|
|
Made a quick PHP script:
Code: | <?php
/* ============================================ CONFIG ============================================ */
$email = "ENTER YOUR EMAIL HERE";
$subject = "ENTER YOUR MESSAGE'S SUBJECT HERE";
/* ============================================ CONFIG ============================================ */
if(!empty($_POST['message'])) {
$email_message = htmlspecialchars($_POST['message']);
$email_message = str_replace("
", "<br />", $email_message);
if(validateEmail($_POST['from']) == FALSE) {
die("Plese enter a valid email");
} else {
$from = $_POST['from'];
}
$mailheaders = "MIME-Version: 1.0\r\n";
$mailheaders .= "Content-type: text/html; charset=iso-8859-1\r\n";
$mailheaders .= "From: Womanizer's Contact Form <[email protected]>\r\n";
$mailheaders .= "Reply-To: Visitor <".$from.">\r\n";
function validateEmail($email) {
if(eregi('^[a-zA-Z0-9._-]+@[a-zA-Z0-9-]+\.[a-zA-Z]{2,4}(\.[a-zA-Z]{2,3})?(\.[a-zA-Z]{2,3})?$', $email))
return true;
else
return false;
}
$mail = mail($email, $subject, $email_message, $mailheaders);
if($mail) {
echo "Your mail was sent successfully.";
} else {
echo "Oh no, something messed up";
}
} else {
?>
<form action="" method="POST">
<label for="from">Your Email: </label> <input type="text" name="from" /><br />
<label for="message">Your message:</label> <textarea rows="5" cols="20" name="message"></textarea><br />
<input type="submit" value="Contact" />
</form>
<?php
}
?> |
It's not super secure, but it works. _________________
|
|